Make WordPress Core

Ticket #11058: 11058.diff

File 11058.diff, 1.7 KB (added by wonderboymusic, 13 years ago)
  • wp-includes/taxonomy.php

    diff --git wp-includes/taxonomy.php wp-includes/taxonomy.php
    index 955369e..b81d8cd 100644
    function get_taxonomy_labels( $tax ) {  
    466466 * @param string $object_type Name of the object type
    467467 * @return bool True if successful, false if not
    468468 */
    469 function register_taxonomy_for_object_type( $taxonomy, $object_type) {
     469function register_taxonomy_for_object_type( $taxonomy, $object_type ) {
    470470        global $wp_taxonomies;
    471471
    472         if ( !isset($wp_taxonomies[$taxonomy]) )
     472        if ( ! isset( $wp_taxonomies[$taxonomy] ) )
    473473                return false;
    474474
    475         if ( ! get_post_type_object($object_type) )
     475        if ( ! get_post_type_object( $object_type ) )
    476476                return false;
    477477
    478478        if ( ! in_array( $object_type, $wp_taxonomies[$taxonomy]->object_type ) )
    function register_taxonomy_for_object_type( $taxonomy, $object_type) {  
    481481        return true;
    482482}
    483483
     484/**
     485 * Remove an already registered taxonomy from an object type.
     486 *
     487 * @package WordPress
     488 * @subpackage Taxonomy
     489 * @since 3.7.0
     490 * @uses $wp_taxonomies Modifies taxonomy object
     491 *
     492 * @param string $taxonomy Name of taxonomy object
     493 * @param string $object_type Name of the object type
     494 * @return bool True if successful, false if not
     495 */
     496function unregister_taxonomy_from_object_type( $taxonomy, $object_type ) {
     497        global $wp_taxonomies;
     498
     499        if ( ! isset( $wp_taxonomies[$taxonomy] ) )
     500                return false;
     501
     502        if ( ! get_post_type_object( $object_type ) )
     503                return false;
     504
     505        foreach ( array_keys( $wp_taxonomies[$taxonomy]->object_type ) as $array_key ) {
     506                if ( $wp_taxonomies[$taxonomy]->object_type[$array_key] === $object_type ) {
     507                        unset( $wp_taxonomies[$taxonomy]->object_type[$array_key] );
     508                        return true;
     509                }
     510        }
     511       
     512        return false;
     513}
     514
    484515//
    485516// Term API
    486517//