Removes WordPress posts (post_type: post) menu from admin interface.
- Removes "Posts" menu item from WordPress admin sidebar
- Lightweight - single hooked function
- Does not affect Custom Post Types - only native WordPress posts
- Unique prefixes (torwald45_disable_posts_menu_) for all function names to prevent conflicts
URL blocking functionality has been disabled (commented out in code) due to conflicts with ACF Pro and other plugins that use WordPress admin pages for their own custom functionality.
Menu removal provides sufficient protection against accidental post creation. If you need stricter access control, see the GitHub issue for possible implementation strategies.
- WordPress 5.0 or higher
- PHP 7.4 or higher
- Open your theme's
functions.phpfile - Copy the entire content from
disable-posts-menu.php - Paste at the end of your
functions.php - Save the file
- Install and activate the Code Snippets plugin
- Go to Snippets → Add New
- Copy content from
disable-posts-menu.phpWITHOUT the opening<?phptag - Paste into the Code field
- Activate the snippet
Once installed and activated:
- The "Posts" menu item will be removed from WordPress admin sidebar
- Direct URL access to post management pages is possible but WordPress will handle appropriately
- Custom Post Types remain unaffected and fully accessible
WordPress enables all features by default, which clutters the admin interface unnecessarily. This snippet helps clean up the backend when you don't need the Posts feature:
- Landing pages - Single page sites don't need blog posts
- Portfolio sites - Using Custom Post Types for projects, not blog posts
- Business websites - Static pages only, no blog section
- Client projects - Cleaner admin interface, less confusion
- E-commerce sites - Using WooCommerce products, not posts
Philosophy: Disable everything you don't use. Enable only what you need. If you decide to add a blog later, simply deactivate this snippet.
admin_menu(priority 999) - removes Posts menu item
URL blocking functionality is commented out in the code due to conflicts with plugins like ACF Pro. The blocking logic cannot reliably distinguish between:
- Direct attempts to access post management pages
- Legitimate plugin usage of WordPress admin pages for custom functionality
For details and possible solutions, see the related GitHub issue.
See CHANGELOG.md for version history.
GPL v2 or later