[Snapshot Pro] My site only works when Snapshot is enabled. Conflict with mu-plugin.

Through a plugin conflict test, I have discovered that my entire site breaks (500) when Snapshot is not enabled. Turns out, there is a line in a mu-plugin which throws an error ONLY when Snapshot is disabled. Now I am trying to sort out the connection between the two. Since this will require providing a lot more detail, I am going to submit this post, then return and add to it.

  • kalico
    • The Bug Hunter

    Ok, here we go….

    The site is http://dev.nrocnetwork.org (not secure….just bypass any warnings)

    I removed all plugins to a different folder, load up the site, and I get a 500 error.

    Tailed the apache log, and here is the error that is thrown, along with stack trace:

    PHP Fatal error:  Uncaught Error: Call to undefined function remove_meta_box() in /var/www/html/wp-content/mu-plugins/member_post_create.php:25n

    Stack trace:n
    #0 /var/www/html/wp-includes/class-wp-hook.php(286): create_member_post_type('')n
    #1 /var/www/html/wp-includes/class-wp-hook.php(310): WP_Hook->apply_filters(NULL, Array)n
    #2 /var/www/html/wp-includes/plugin.php(453): WP_Hook->do_action(Array)n
    #3 /var/www/html/wp-settings.php(467): do_action('init')n
    #4 /var/www/wp-config.php(152): require_once('/var/www/html/w...')n
    #5 /var/www/html/wp-load.php(42): require_once('/var/www/wp-con...')n
    #6 /var/www/html/wp-blog-header.php(13): require_once('/var/www/html/w...')n
    #7 /var/www/html/index.php(17): require('/var/www/html/w...')n
    #8 {main}n
    thrown in /var/www/html/wp-content/mu-plugins/member_post_create.php on line 25, referer: https://dev.nrocnetwork.org/resources/

    That mu-plugin was created to support an old plugin from a WP 3.1 site that we had to convert to our new site (now on 5.1). Here is the first part of that plugin, up to the point where it fails at line 25:

    * Register member post type.
    add_action( 'init', 'create_member_post_type' );
    function create_member_post_type() {
    register_post_type( 'member',
    'labels' => array(
    'name' => __( 'Members' ),
    'singular_name' => __( 'Member' ),
    'add_new' => _x( 'Add New Member to the Map','Member Singular name'),
    'add_new_item' => __( 'Add New Member to the Map'),
    'new_item' => __( 'New Member'),
    'edit_item' => __( 'Edit Member'),
    'view_item' => __( 'View Member'),
    'all_items' => __( 'All Members')
    'public' => true,
    'has_archive' => true,
    'supports' => array( 'title' )
    remove_post_type_support( 'member', 'editor');
    remove_meta_box( 'postcustom' , 'member' , 'normal' );

    Now I need to figure out what in Snapshot Pro is causing this to fail, and why it does not fail gracefully and load the site anyway.

    (Note: I cannot move this to a custom post type plugin. Tried many times, and it never worked. This was the only solution that we could come up with.)

    This site is difficult to provide access to for outsiders. We require SFTP with a .pem file on your local drive, and we have to know a stable IP address that you are coming from. So I am more than happy to provide any additional information that might help diagnose the problem.

    If someone wants to access the site directly, we’ll have to work with you to get your IP address added to our system for access and provide you with a .pem file.

    Thanks for any advice!!

  • Nithin
    • Support Wizard

    Hi kalico,

    Hope you are doing good today. :slight_smile:

    The remove_meta_box function is called too early with init hook, it’s not exactly clear why it only works when Snapshot is enabled, but most probably the Snapshot plugin would be supporting this early invoke, and hence working fine.

    Could you please try calling the remove_meta_box via a different hook, and see how it goes? That’s for example, remove the function from the above code, and add it outside create_member_post_type function as:

    function remove_post_custom_fields() {
    remove_meta_box( 'postcustom' , 'member' , 'normal' );
    add_action( 'admin_menu' , 'remove_post_custom_fields' );

    And see whether it works fine. I hope this helps. Please let us know how that goes. Have a nice day ahead. :slight_smile:



Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.