postpone jump out on AJAX calls for Statify 1.7 compatibility (#22)

Statify 1.7 changed the JS tacking endpoint to WP AJAX, so we must not
skip the complete initialization on AJAX calls anymore. The routine now
breaks after adding the filter (if necessary).
This commit is contained in:
2020-05-20 10:26:57 +02:00
committed by GitHub
parent 9caa7b0678
commit 902e211552
2 changed files with 10 additions and 2 deletions

View File

@ -81,8 +81,8 @@ class StatifyBlacklist {
* @return void
*/
public static function init() {
// Skip on autosave or AJAX.
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
// Skip on autosave.
if ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) ) {
return;
}
@ -97,6 +97,11 @@ class StatifyBlacklist {
add_filter( 'statify__skip_tracking', array( 'StatifyBlacklist', 'apply_blacklist_filter' ) );
}
// Statify uses WP AJAX as of 1.7, so we need to reach this point. But there are no further admin/cron actions.
if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
return;
}
// Admin only filters.
if ( is_admin() ) {
StatifyBlacklist_Admin::init();