How to add a return status 404?

How to add a return status 404 when navigating to the admin page to unregistered users?

sodlip.ru

Thanks in advance!
July 9th 19 at 14:36
1 answer
July 9th 19 at 14:38
Solution
if( !current_user_can('option that can only admin') ){
 header('HTTP/1.1 404 Not Found');
 header('Location: /404.html');
 exit(); // just in case if(true !== false) :D
}

roles and opportunities
By the way, the header will be only in the case if you invoke the function in the beginning.
We have Skype do you have? - broderick.Gutmann50 commented on July 9th 19 at 14:41
: k0s0lapus (from 22 to 01 GMT, the rest of the text) - rachelle.Gutkows commented on July 9th 19 at 14:44

Find more questions by tags WordPress