Have you ever wanted to get rid of that content editor block in your custom post types? You know, that big empty space sitting there taking up room when you don’t need it? This is how you can hide it without using plugins.
The Solution
All you need is ONE line of code. Just add this to your theme’s functions.php file:
remove_post_type_support('your-post-type', 'editor');
Swap out ‘your-post-type’ with whatever post type you’re working with. For example, if you’ve got a custom post type for reviews, you’d use:
remove_post_type_support('review', 'editor');
To make sure it works properly, we call this code inside of an init hook:
function hide_that_annoying_editor() { remove_post_type_support('review', 'editor'); } add_action('init', 'hide_that_annoying_editor');
Why This Is Awesome
This method is:
- Super lightweight (no plugin needed!)
- Works with both Gutenberg AND the classic editor
- It won’t break when WordPress updates
- It takes literally seconds to implement
When Would You Use This?
This comes in handy when:
- You’re using custom fields for all your content
- You’ve got a post type that only needs images or other media
- You want to keep your clients from messing with the main content area 😉
And that’s it. Pretty simple, right? There is no need for bulky plugins or complicated solutions. Just one line of code, and you’re good to go.