So below is the action to add widget in the WordPress dashboard. How can i add widgets in my plugin's page?

add_action('wp_dashboard_setup', 'csc412_dashboard_widgets');

    function csc412_dashboard_widgets() {
        global $wp_meta_boxes;

        wp_add_dashboard_widget('custom_help_widget', 'Good morning', 'custom_dashboard_help');
    function custom_dashboard_help() {

        global $current_user;
        $username = $current_user->user_login;

        echo 'Greetings, '.$username.'. Today is ' . Date('m/d/Y');
  • Do you mean giving your plugin a settings page? If so: codex.wordpress.org/Settings_API – Peter HvD Feb 16 '18 at 16:21
  • no no. This function adds widget to the WordPress dashboard. I want make that widget to appear to a custom page of my preference instead of the WordPress dashboard – csandreas1 Feb 16 '18 at 16:29
  • Then I think you're looking in the wrong place. It's the Settings API you want for that. – Peter HvD Feb 16 '18 at 16:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.