Make WordPress Core


Ignore:
Timestamp:
01/15/2016 12:19:15 PM (8 years ago)
Author:
swissspidy
Message:

Post Types: Introduce unregister_post_type().

This new function can be used to completely unregister non built-in post types.

Fixes #14761.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/utils.php

    r36272 r36316  
    336336 */
    337337function _unregister_post_type( $cpt_name ) {
    338     unset( $GLOBALS['wp_post_types'][ $cpt_name ] );
    339     unset( $GLOBALS['_wp_post_type_features'][ $cpt_name ] );
    340 
    341     foreach ( $GLOBALS['wp_taxonomies'] as $taxonomy ) {
    342         if ( false !== $key = array_search( $cpt_name, $taxonomy->object_type ) ) {
    343             unset( $taxonomy->object_type[$key] );
    344         }
    345     }
     338    unregister_post_type( $cpt_name );
    346339}
    347340
Note: See TracChangeset for help on using the changeset viewer.