Skip to content

Instantly share code, notes, and snippets.

@voneff
Last active October 10, 2018 01:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save voneff/68bc142f9411fbbe191a14cfe2049009 to your computer and use it in GitHub Desktop.
Save voneff/68bc142f9411fbbe191a14cfe2049009 to your computer and use it in GitHub Desktop.
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