Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using the sweet custom dashboard plugin. When I go to the dashboard then it shows this example.com/wp-admin/index.php?page=custom-dashboard type of link. But I want to show example.com/wp-admin/dashboard, or I want to change it somehow. How could I do that?

sweet-custom-dashboard.php code:

// plugin folder url
if(!defined('RC_SCD_PLUGIN_URL')) {
    define('RC_SCD_PLUGIN_URL', plugin_dir_url( __FILE__ ));
}

/*
|--------------------------------------------------------------------------
| MAIN CLASS
|--------------------------------------------------------------------------
*/

class rc_sweet_custom_dashboard {

    /*--------------------------------------------*
     * Constructor
     *--------------------------------------------*/

    /**
     * Initializes the plugin by setting localization, filters, and administration functions.
     */
    function __construct() {

        add_action('admin_menu', array( &$this,'rc_scd_register_menu') );
        add_action('load-index.php', array( &$this,'rc_scd_redirect_dashboard') );

    } // end constructor

    function rc_scd_redirect_dashboard() {

        if( is_admin() ) {
            $screen = get_current_screen();

            if( $screen->base == 'dashboard' ) {

                wp_redirect( admin_url( 'index.php?page=custom-dashboard' ) );

            }
        }

    }



    function rc_scd_register_menu() {
        add_dashboard_page( 'Projukti Chowa Dashboard', 'Projukti Chowa Dashboard', 'read', 'custom-dashboard', array( &$this,'rc_scd_create_dashboard') );
    }

    function rc_scd_create_dashboard() {
        include_once( 'custom_dashboard.php'  );
    }


}

// instantiate plugin's class
$GLOBALS['sweet_custom_dashboard'] = new rc_sweet_custom_dashboard();

?>
share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.