• I am trying to add a Menu in WordPress Admin Panel. I am using below code.

    This code is working.

    
    add_submenu_page('weather_info', 'Weather Information', 'Weathers', 'manage_options', 'weathers', [$this, 'weathers']);
    

    But below code is not working. I am facing error Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'edit.php?post_type=weather' not found or invalid function name .

    
    add_submenu_page('weather_info', 'Weather Information', 'Weathers', 'manage_options', 'weathers', 'edit.php?post_type=weather');
    
    • This topic was modified 2 years, 5 months ago by t-p. Reason: Moved to Fixing WordPress from Developing with WordPress
Viewing 1 replies (of 1 total)
  • In your second example that’s not owrking, you have not given it a function to execute. You have changed that to ‘edit.php?post_type=weather’ and WordPress/PHP can’t execute that as a function.

    Look at your first example and you will see what it’s meant to look like.

Viewing 1 replies (of 1 total)
  • The topic ‘add_submenu_page() issue’ is closed to new replies.