mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-25 15:54:26 +00:00
Post Types: Introduce unregister_post_type().
This new function can be used to completely unregister non built-in post types. Fixes #14761. git-svn-id: https://develop.svn.wordpress.org/trunk@36316 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -335,14 +335,7 @@ if ( !function_exists( 'str_getcsv' ) ) {
|
||||
* Removes the post type and its taxonomy associations.
|
||||
*/
|
||||
function _unregister_post_type( $cpt_name ) {
|
||||
unset( $GLOBALS['wp_post_types'][ $cpt_name ] );
|
||||
unset( $GLOBALS['_wp_post_type_features'][ $cpt_name ] );
|
||||
|
||||
foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy ) {
|
||||
if ( false !== $key = array_search( $cpt_name, $taxonomy->object_type ) ) {
|
||||
unset( $taxonomy->object_type[$key] );
|
||||
}
|
||||
}
|
||||
unregister_post_type( $cpt_name );
|
||||
}
|
||||
|
||||
function _unregister_taxonomy( $taxonomy_name ) {
|
||||
|
||||
Reference in New Issue
Block a user