0

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';
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.