Hide dashboard from non-admin users

Is it possible to hide the dashboard completely from the Non-admin users and give them access to only New post and edit posts page? Thanks. 4 s 4 As far as ease of use, especially for WordPress Admins not too firm in PHP, I second brasoflo’s plugin recommendation (Adminimize). For the sake of completeness, this … Read more

Show Custom Taxonomy Inside Custom Menu

I have a custom menu using add_menu_page: add_menu_page(‘My menu’ , ‘Some text’, ‘read’, ‘nwcm’); Under it, I show a custom post type menu item; // Create the news custom post type register_post_type(‘nwcm_news’, array( ‘labels’ => array( ‘name’ => __(‘News for clients’, NWCM_TEXT_DOMAIN) , ‘singular_name’ => __(‘News’, NWCM_TEXT_DOMAIN) ) , ‘public’ => true, ‘has_archive’ => true, … Read more

Displaying Custom Post Types In “At A Glance” Meta Box

I found the following snippet will displays the number of Custom Post Types published in Dashboard’s At A Glance widget, like this: Is there a way to turn that “81 Wrestlers” text to a link to the post types list. Here’s the code: add_filter( ‘dashboard_glance_items’, ‘custom_glance_items’, 10, 1 ); function custom_glance_items( $items = array() ) … Read more

Why not register shortcodes if is_admin dashboard?

I have noticed that some plugins such as Contact-form-7, Nextgen-gallery, possibly others, have an interesting anti-feature of not registering their shortcodes when is_admin() is true. The problematic thing is, if you want to generate some dynamic content (which may have shortcode) from ajax, and use the “correct” wp way of doing it, admin-ajax.php, it is … Read more

How to fix the admin menu margin-top bug in WordPress 5.5?

I recently updated a WordPress instance from 5.4 to 5.5 to end up with an annoying margin-top in the admin area, above the menu directly. I deactivated all plugins, switched themes, did some inspection, and I ended up with some findings. The CSS class causing the margin-top is .php-error, which is appended to #adminmenuwrap when … Read more