Support » Plugin: Jetpack Only for Admins » conflict with AJAX due to PHP warning

Viewing 4 replies - 1 through 4 (of 4 total)
  • I have not encountered this bug on my WP site. However using ‘admin_init’ correctly hides the Jetpack menu items, but ‘admin_menu’ does NOT.

    Well, I believe my other fix was something like if (defined('DOING_AJAX') && DOING_AJAX) return;. You don’t need to add menus in admin_init when doing AJAX.

    But the correct way is probably ‘admin_menu’. Maybe change the priority so it works with JetPack?

    I am experiencing the same issue where if I change ‘admin_init’ to ‘admin_menu’ then it resolves the errors, but no longer hides the Jetpack menu item.

    Could you elaborate on how exactly to implement one of your other fixes?

    Try this:

    Version: 1.1, file jp-rm-jpmenu.php, line 36:

    add_action( 'admin_init', 'jp_rm_menu' );

    Change to:

    add_action( 'admin_menu', 'jp_rm_menu', 2000 );
    // Note Jetpack 3.0.2 uses 'admin_menu' priority 998 and 999

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘conflict with AJAX due to PHP warning’ is closed to new replies.