How to use control_callback when creating a widget via functions.php or plugin?

Actually the from fields only should be in the control_callback function , both form and handling so try this: <?php /* Plugin Name: custom dashboard widget Plugin URI: http://en.bainternet.info Description: custom dashboard widget with control form Version: 0.1 Author: bainternet Author URI: http://en.bainternet.info */ //show widget function custom_dashboard_widget_coach() { //get saved data if ( !$widget_options … Read more

Delete Custom Dashboard Widgets

The built-in dashboard widgets are not marked somehow, you have to use a fixed list: ‘dashboard_right_now’, ‘dashboard_plugins’, ‘dashboard_quick_press’, ‘dashboard_recent_drafts’, ‘dashboard_recent_comments’, ‘dashboard_incoming_links’, ‘dashboard_primary’, ‘dashboard_secondary’ So your code should test if the current widget is in that list and remove the widget, if it isn’t: add_action( ‘wp_dashboard_setup’, ‘t5_remove_custom_dashboard_widgets’, 11 ); function t5_remove_custom_dashboard_widgets() { global $wp_meta_boxes; $builtin = … Read more

How to add menu to Dashboard that can be viewed by all users

You have to use the right capability for this. You chose manage_options, which by default only users with an Administrator user role have. So, change it to read or exist, for instance, and every user will be able to see and access the menu. add_dashboard_page( ‘custom menu title’, ‘Test’, ‘read’, ‘custompage’, ‘my_custom_menu_page’, plugins_url( ‘test/images/icon.png’ ), … Read more

Extension preview disapeared since WP 4.5.2

Your error log does tell you the reason, it’s the part about: Refused to display … in a frame because it set to ‘X-Frame-Origin’ to ‘SAMEORIGIN,DENY’ And the reason for that is the one about “conflicting values” before it. WordPress core only sends SAMEORIGIN value in admin screens, via send_frame_options_header(). So DENY is coming from … Read more

How to make post and comment count unclickable with dashboard_glance_items hook

The dashboard_glance_items filter is only useful for modifying the extra elements. The posts/comments data elements have already been displayed. Here are three ideas: Method #1 – Use the dashboard_glance_items filter: You can use the following filter setup, to remove the posts/pages/comments elements from the output of wp_dashboard_right_now(). The trick is simple, foul WordPress to think … Read more

Custom wp_welcome_panel for every role or custom dashboard

Where is the “Welcome Panel”? The WordPress dashboard (which houses the “Welcome Panel”) basically is the ~/wp-admin/index.php When does it show? As you can see when looking at the source, there’s the following check: if ( has_action( ‘welcome_panel’ ) && current_user_can( ‘edit_theme_options’ ) ) How to bypass the needed capability? Make it available for everyone! … Read more

How do I disable dashboard update notifications for subscribers?

you can include some custom css in your functions.php that hides the update_nag (notifications) element dependent on user capability: add_action(‘admin_head’,’admin_css’); function admin_css() { if(!current_user_can(‘administrator’))//not and admin { echo ‘<style>’; echo ‘.update_nag{display:none}’; echo ‘</style>’; } }