Many WordPress themes come with their own custom post types. Those may be FAQs, Portfolio, Books or any other. Installing the theme forces you to deal with those extra custom post types and taxonomies. Some themes allow you to disable them, some not. Here is how to deregister custom post type or custom taxonomy in any theme.

First, locate the post type or taxonomy name. Navigate to the custom post type or the custom taxonomy (eg. category, tag) and take a look at the url.

Now that we know the name of the post type/taxonomy we can deregister it from WordPress.

PHP Snippet: Deregister custom post type or custom taxonomy

As of WordPress 4.5 there is function to do that, unregister_post_type() and unregister_taxonomy() . In your child theme’s functions.php paste the following code:

function webroom_deregister_post_type(){
  unregister_post_type( 'faq' );
  unregister_taxonomy( 'faq_category');
}
add_action('init','webroom_deregister_post_type');

And that’s it – just replace “faq” and “faq_category” with your post type taxonomy. In your WordPress admin dashboard you’ll see the custom post type / taxonomy isn’t there anymore.

Note that using unregister_post_type() or unregister_taxonomy() functions won’t cleanup on your installation – it won’t remove any data from the database. To do that you can manually delete those records using the following query: DELETE FROM wp_posts WHERE post_type = ‘[your custom post type].

Last thing to do is to save again your permalinks to refresh them.

PHP Snippet: Remove Portfolio and FAQ custom post type from Avada theme.

If you are running Avada WordPress theme and want to get rid of Portfolio and FAQs custom post type and theirs custom taxonomies – FAQ Categories, Portfolio Categories, Skills, Tags use the following code:

function webroom_deregister_post_type(){
  unregister_post_type( 'avada_portfolio' );
  unregister_post_type( 'avada_faq' );
  unregister_taxonomy( 'portfolio_category');
  unregister_taxonomy( 'portfolio_tags');
  unregister_taxonomy( 'portfolio_skills');
  unregister_taxonomy( 'faq_category');
}
add_action('init','webroom_deregister_post_type');

Learn more about the functions used in this tutorial:

Advertisements
Jetpack

Recent Articles

Categories

Jetpack

Related Articles

If you enjoyed reading this, then please explore our other articles below:

Comments

Leave a comment

Leave a Reply

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

Advertisements