• Matthew Roe

    (@matthew-roe)


    Hey guy’s,

    I’m in the middle of developing a plugin. Well, I want to add a sub-page to my menu tab that will re-direct the admin to another page.

    I know the PHP redirect code is:

    <?php
    
       header( 'Location: http://www.yourdomain.com/whatever' ) ;
    
    ?>

    So, here’s my questions:

    1. How do I get the re-direct to open in a new tab?
    2. How do I get the submenu to redirct?

    I’ve tried putting the redirect.php file inside the plugin tab, I used this code inside of it:

    add_menu_page('Create With Matt SEO', 'CMW SEO', 'read', 'createwithmattseo', 'cwm_seo', WP_PLUGIN_URL.'/createwithmattseo/icon.png');
    			add_submenu_page('createwithmattseo','CWM SEO Help','CWM SEO Help', 'read', 'create-with-matt-seo-help', 'cwm_seo_help');
    			add_submenu_page('createwithmattseo','On Page SEO Tips','On Page SEO Tips', 'read', 'onpageseotips', WP_PLUGIN_URL.'/createwithmattseo/on-page-seo-tips.php');
     	//add_plugins_page('Create With Matt SEO', 'CWM SEO', 'read', 'create-with-matt-seo', 'cwm_seo');
    	//add_plugins_page('Create With Matt SEO', 'CWM SEO Help', 'read', 'create-with-matt-help', 'cwm_seo_help');
    	//add_plugins_page('Create With Matt SEO', 'On Page SEO Tips', 'read', 'on-page-seo-tips', 'on_page_seo_tips');
    }

    That doesn’t seem to work though, I’m just getting an error:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘http://createwithmatt.com/test/wp-content/plugins/createwithmattseo/on-page-seo-tips.php&#8217; was given in /home/createwi/public_html/test/wp-includes/plugin.php on line 405

    So, what am I doing wrong and how can I fix it?

    Matt

  • The topic ‘Submenu redirect’ is closed to new replies.