Edit/remove wp_dashboard_recent_drafts()

Updated answer: Let’s modify the corresponding dashboard query so it returns no draft posts. Example: If I recall correctly the default Hello World post has ID=1 and the default Sample Page has ID=2. So if we set ID=2, then we can remove the draft list, since it is fetching the post post type. Since WordPress … Read more

Hide the wp-admin bar from dashboard

This might be not proper approach but this worked for me while testing. You can use these combinations to remove all links from Toolbar (admin-bar ) and then hide empty tool bar with css: function remove_admin_bar_links() { global $wp_admin_bar; $wp_admin_bar->remove_menu(‘wp-logo’); // Remove the WordPress logo $wp_admin_bar->remove_menu(‘about’); // Remove the about WordPress link $wp_admin_bar->remove_menu(‘wporg’); // Remove … Read more

How do I customize the dashboard?

Subscribers will see the WP Events and News widget, but they shouldn’t be seeing the other stuff. Somewhere the theme and/or plugins are adding widgets in a way that’s allowing all user levels to see them. You can either hit up the support teams for the themes and plugins that are adding them, or you … Read more

syntax issue on php 7.4

Option 1 Have you tried changing the function name? something similar function getClientFn($function){}? You can keep any name you want. function getClientFn($function){ return ‘\DisplaceTech\Companies\\’ . $function; } function add_clients_metabox(){ $screens = [‘page’]; foreach ($screens as $screen) { add_meta_box( ‘clients’, // Unique ID __(‘Clients’), // Box title getClientFn(‘clients_box_html’), // Content callback, must be of type callable … Read more

Create a fullwidth dashboard widget

Here’s perhaps a little hacky way to achieve a full width dashboard widget. Here we force the first (left-most) column to be 100% and to contain our custom widget. Step 1 WP stores the Dashboard widget visibility and order as user specific option. To get the below code working we need to prevent the user’s … Read more

Cannot access WordPress Multisite Main Dashboard

You can gain super admin access to the site by adding this function in the functions.php file if ( !function_exists( ‘grant_super_admin’ ) ) { require_once ABSPATH . WPINC . ‘/capabilities.php’; } // ID of the user to be granted Super Admin privileges. $user_id = 1; $result = grant_super_admin($user_id); You can remove the code once you … Read more