How to block the WP admin menus form loading depending on the current URL?

Question

How can I block the WordPress admin menus and admin bar from loading depending on the URL.

So that when a user visits a certain page in the admin area he will only see the wp-content block while the admin menu and the admin bar are blocked from loading altogether.

I don’t want CSS solution but PHP solution which totally blocks those 2 blocks from loading altogether.

For example:

//get the current url
$url = $_SERVER['REQUEST_URI'];

// The url that blocks the WP admin menus
$blockUrl = 'http://localhost:80/wordpress/wp-admin/bd';

if($url == $blockUrl){
   // block the wp admin menu from loading in that page
} else{
   echo 'failed to block menus';
}
0
, , , Axmed nuur 3 years 2019-10-30T03:03:41-05:00 0 Answers 81 views 0

Leave an answer

Browse
Browse