I created some custom post types, but I would like to hide them in the dashboard from Subscribers, Authors, and Editors (essentially, just allow administrators to access them).
Can I do this without installing a plugin?
I created some custom post types, but I would like to hide them in the dashboard from Subscribers, Authors, and Editors (essentially, just allow administrators to access them).
Can I do this without installing a plugin?
You must be logged in to post a comment.
I’m sure you could specify some capabilities while registering the Post Type itself. Although, here is a more robust version that can be used widely across the administration dashboard.
In order to fire the function, you must add the action.
The above code only goes as far as hiding the admin menus form displaying to the user. They can still directly access the pages if they know the correct URLs.
You can use this to deny specific admin pages from being accessed by unprivileged users.
In order to fire the function, you must add the action.