Discover in this tutorial how to unregister a Custom Post Type (CPT) in WordPress using code.
The other day a subscriber told me that he is using Genesis Blocks Pro, but he prefers not to use the Custom Post Type that comes with it. Not only that, but he doesn’t want it to be visible to clients either.
To remove the associated menu you could use the strategy we’ve used in other tutorials, but in this case it would be best to unregister the Custom Post Type directly.
Let’s see how you can do this.
Snippet to unregister a Custom Post Type in WordPress
Add the following code at the end of functions.php or in your functionality plugin:
To unregister “Portfolio Items” you have to use the name that the CTP was registered with, in this case,
Obviously, you can change the slug to the one of the Custom Post Type you are interested in.
To find out what the name the CPT you can click on the CPT menu and inspect the URL that loads. You will see something like this:
Indeed, the key is in the final part
Now you know how to unregister a Custom Post Type created by a third party plugin in WordPress.
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉