• Hi all,

    First time poster. I tried searching everywhere for a solution to this problem before posting. My problem is adding a submenu page. when I use the example, provided here, verbatim I get the following warning:
    “Warning: strip_tags() expects parameter 1 to be string, array given in /(snip)/wp-admin/admin-header.php on line 22”

    It also applies when I use the parent_slug (‘edit.php?post_type=your_post_type’) for a custom post type.

    The issue seems to be related to the $page_title paramater. It does not show within the <title></title> tag and the aforementioned error above.

    I have not found anyone with and mention of this error. I understand it’s only a warning but it is really bugging me. Any help would be appreciated.

    I am using WordPress 3.4.1 with no changes to any core files.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Can you share your code here?

    Thread Starter offbeatgeek

    (@offbeatgeek)

    The example code I linked to causes the problem

    add_action('admin_menu', 'register_my_custom_submenu_page');
    
    function register_my_custom_submenu_page() {
    	add_submenu_page( 'tools.php', 'My Custom Submenu Page', 'My Custom Submenu Page', 'manage_options', 'my-custom-submenu-page', 'my_custom_submenu_page_callback' );
    }
    
    function my_custom_submenu_page_callback() {
    	echo '<h3>My Custom Submenu Page</h3>';
    
    }

    my version is:

    add_action('admin_menu', 'register_my_custom_submenu_page');
    
    function register_my_custom_submenu_page() {
    	add_submenu_page( 'edit.php?post_type=obg_registration', 'Registration Settings', 'Settings', 'manage_options', 'obg-registration-settings', 'my_custom_submenu_page_callback' );
    }
    
    function my_custom_submenu_page_callback() {
    	echo '<h3>Registration Settings</h3>';
    }

    Your code is working fine at my end. Do you have obj_registration name post type?

    Thread Starter offbeatgeek

    (@offbeatgeek)

    The only reason it shows for me is because I have error reporting ALL. Are you including warnings in your reporting settings (php)

    Yes I do have a custom post type called obg_registration. You can see my code snippet below:

    register_post_type('obg_registration', $args);

    edit:
    PS sorry for the delay. I was commuting to work ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘add_submenu_page function causing strip_slashes warning’ is closed to new replies.