use wp_doing_ajax() instead of checking for global constant (#36)

The function is available since WP 4.7, so we could have been using it
since v1.2. It defaults to the same logic but applies an additional
filter internally.
This commit is contained in:
2025-08-28 16:59:33 +02:00
parent 7beb0037f6
commit 24d9bfd74f

View File

@@ -76,7 +76,7 @@ class SCLiveticker {
add_filter( 'rest_scliveticker_tick_query', array( 'SCLiveticker\\Api', 'tick_query_filter' ), 10, 2 ); add_filter( 'rest_scliveticker_tick_query', array( 'SCLiveticker\\Api', 'tick_query_filter' ), 10, 2 );
// Skip on AJAX if not enabled. // Skip on AJAX if not enabled.
if ( ( ! isset( self::$options['enable_ajax'] ) || 1 !== self::$options['enable_ajax'] ) && ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { if ( ( ! isset( self::$options['enable_ajax'] ) || 1 !== self::$options['enable_ajax'] ) && wp_doing_ajax() ) {
return; return;
} }