WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: Dashboard Commander] wordpress.com stats dashboard widget is missing (7 posts)

  1. ddeconin
    Member
    Posted 3 years ago #

    When you have the wordpress.com stats plugin active , the stats dashboard widget is not part of the list of widgets that can be controlled. Some other widgets from other plugins are.

  2. Josh Hartman
    Member
    Posted 3 years ago #

    Thanks for letting me know, I'll take a look at that plugin's code to see how it adds its widget.

  3. Josh Hartman
    Member
    Posted 3 years ago #

    Okay, WordPress.com Stats Dashboard is not adding widgets using the WordPress API method, so I won't be able to support that, but I do have a method of removal for you to use and it can be used for other plugins that may be using the same non-standard method.

    Put the following code into your theme's functions.php file:

    add_filter('wp_dashboard_widgets', 'filter_wp_dashboard_widgets', 99);
    
    function filter_wp_dashboard_widgets($widgets){
    	$widgets_to_remove = array('dashboard_stats');
    	foreach($widgets as $key => $value){
    		if(in_array($value, $widgets_to_remove)){
    			unset($widgets[$key]);
    		}
    	}
    	return $widgets;
    }

    You can modify the $widgets_to_remove array to add more widget names as they come along.

    Hope that takes care of you, thanks!

  4. ddeconin
    Member
    Posted 3 years ago #

    Thx for the workaround, ill try it soon !

  5. Tevya
    Member
    Posted 3 years ago #

    So for me, it shows up fine in an admin account, but I also want the WordPress.com stats widget to show up for editors. Is there any chance this plugin is currently preventing Editors from seeing it?

  6. Josh Hartman
    Member
    Posted 3 years ago #

    Yes, the WordPress.com Stats plugin code specifies the only users with the 'manage_options' capability can view the dashboard widget.

  7. Tevya
    Member
    Posted 3 years ago #

    Ah, okay, thank you.

Topic Closed

This topic has been closed to new replies.

About this Topic