WordPress
December 21, 2020

How to Block Dashboard Access for Non-Admins WordPress

Removing the Admin Bar for Non-Admins

Removing the admin bar is a simple code snippet. I’ve shown before how you can hide the admin bar conditionally for users. In there I’ve not mentioned how you can hide it for everyone but admins, so thats where this code snippet comes in. You need to add the code to your child theme’s functions.php file or via a plugin that allows custom functions to be added, such as the Code snippets plugin.

Block Dashboard Access for Non-Admins

The best way to handle someone trying to access the dashboard is to redirect them to another page. You can consider redirecting them back to the primary landing page of your site, their front-end profile (if there’s any) or just redirect them back to the page they came from.

Related Post


Set time Zone by Country

Include the following code file to your current themes functions.php file. Users can see all time by their country timezone wise.

Prevent svg translation of fontawesome icon

Add Following script in head so use below code in your current themes header.php file. And also you have to add following script before your fontawesome css link.

How To Create Meta Boxes in WordPress

A meta box is a draggable box displayed in the post editing screen in the backend of WordPress. Users can select or enter extra information in meta boxes addition to the content in the main post editing area. There are two types of data you can enter in meta boxes: metadata (i.e. custom fields), and […]

Disable Payments on WooCommerce

You are using WooCommerce for your eCommerce website. A thing is you want to disable payment on your website, but disabling in WooCommerce payment setting WooCommerce > Settings > Payments will not work and display There are no payment methods available. Add this code to functions.php file of theme.

How to create custom widgets in wordpress

Include the following code file to your current themes functions.php file Here is the code for sidebar register.

How to Removing the Editor from a WordPress default Post type

For remove wordpress post editor add following code in your current themes functions.php file.


Leave a Reply

Your email address will not be published. Required fields are marked *