Last active
October 10, 2018 01:40
-
-
Save voneff/68bc142f9411fbbe191a14cfe2049009 to your computer and use it in GitHub Desktop.
WordPress: unregister custom post type registered by plugin "Essential Grid"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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