-
-
Save bewho/ff83c5bcf19f49a8a13cf6c1378cce60 to your computer and use it in GitHub Desktop.
WordPress: unregister custom post type registered by plugin "Essential Grid"
This file contains hidden or 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