WordPress.org

Support

Support » Plugins and Hacks » Posts 2 Posts » [Resolved] [Plugin: Posts 2 Posts] Infinite search wheel

[Resolved] [Plugin: Posts 2 Posts] Infinite search wheel

  • I have Clients and Projects CTPs which I registered with CPT UI.

    In my functions…

    function my_connection_types() {
        if ( !function_exists('p2p_register_connection_type') )
            return;
    
        p2p_register_connection_type( 'projects', 'clients', true );
    }
    add_action('init', 'my_connection_types', 100);

    Metabox shows up fine.

    I have added a client called Eric Brown. When type in ‘Eric’ into the metabox, it begins searching then gives me this response (from firebug)

    <br />
    <b>Warning</b>:  Invalid argument supplied for foreach() in <b>/Users/Jared/Sites/htdocs/projects/wp-admin/includes/plugin.php</b> on line <b>1264</b><br />
    <br />
    <b>Warning</b>:  Invalid argument supplied for foreach() in <b>/Users/Jared/Sites/htdocs/projects/wp-admin/includes/plugin.php</b> on line <b>1264</b><br />
    <br />
    <b>Warning</b>:  Invalid argument supplied for foreach() in <b>/Users/Jared/Sites/htdocs/projects/wp-admin/includes/plugin.php</b> on line <b>1264</b><br />
    <br />
    <b>Warning</b>:  Invalid argument supplied for foreach() in <b>/Users/Jared/Sites/htdocs/projects/wp-admin/includes/plugin.php</b> on line <b>1264</b><br />
    <br />
    <b>Warning</b>:  Invalid argument supplied for foreach() in <b>/Users/Jared/Sites/htdocs/projects/wp-admin/includes/plugin.php</b> on line <b>1264</b><br />
    {"27":"Eric Brown"}

    This is on a fresh 3.1 RC3 install.

    Any ideas where to look?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Very strange. So I tracked down line 1264 and it had to do with remove_menu_page which I was indeed using.

    Once I commented out this

    //add_action('admin_init', 'remove_admin_menus');
    function remove_admin_menus(){
    	remove_menu_page('edit.php'); // Posts
    	remove_menu_page('upload.php'); // Media
    	remove_menu_page('link-manager.php'); // Links
    	remove_menu_page('edit-comments.php'); // Comments
    	remove_menu_page('tools.php'); // Tools
    }

    and tried it again the searched worked without any issues.

    Plugin Author scribu

    @scribu

    ‘admin_init’ will fire for ajax requests too. You should be using ‘admin_menu’ instead.

    Thanks scribu!

    Originally I was actually looking at your usage example on trac 😛

    http://core.trac.wordpress.org/ticket/14666#comment:6

    Much appreciated!

    Plugin Author scribu

    @scribu

    Corrected. 😉

    I made this same mistake, using the correct admin_menu will also fix some style issues that result from using admin_init to remove menus (when removing comments menu the pages menu is left at the bottom of a menu group without the proper classes)

    Thanks @scribu!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Resolved] [Plugin: Posts 2 Posts] Infinite search wheel’ is closed to new replies.
Skip to toolbar