Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
WordPress: unregister custom post type registered by plugin "Essential Grid"
<?php
/*
* Use this funtion to delete the custom post type registered by the plugin "Essential Grid"
* Alternative method to the one proposed by plugin authors:
* https://www.themepunch.com/faq/hide-ess-grid-posts-custom-post-type-from-wp-main-menu/
*
* Usage for other CPT: Replace 'essential_grid' with the slug of the custom post type
*
* Sources:
* https://gist.github.com/johnkolbert/769160
* https://core.trac.wordpress.org/ticket/14761
*/
if ( ! function_exists( 'unregister_post_type' ) ) :
function unregister_post_type() {
global $wp_post_types;
if ( isset( $wp_post_types[ 'essential_grid' ] ) ) {
unset( $wp_post_types[ 'essential_grid' ] );
return true;
}
return false;
}
endif;
add_action('init', 'unregister_post_type',100);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment