WordPress.org

Make WordPress Core

Ticket #14482: taxonomy.patch

File taxonomy.patch, 1.1 KB (added by leewillis77, 4 years ago)

Patch to implement required function.

  • wp-includes/taxonomy.php

    diff -ru orig/wp-includes/taxonomy.php new/wp-includes/taxonomy.php
    old new  
    397397        return true; 
    398398} 
    399399 
     400/** 
     401 * Remvoe an already registered taxonomy from an object type. 
     402 * 
     403 * @package WordPress 
     404 * @subpackage Taxonomy 
     405 * @since 3.0.2 
     406 * @uses $wp_taxonomies Modifies taxonomy object 
     407 * 
     408 * @param string $taxonomy Name of taxonomy object 
     409 * @param string $object_type Name of the object type 
     410 * @return bool True if successful, false if not 
     411 */ 
     412function unregister_taxonomy_from_object_type($taxonomy, $object_type) { 
     413 
     414        global $wp_taxonomies; 
     415 
     416        if ( !isset($wp_taxonomies[$taxonomy]) ) 
     417                return false; 
     418 
     419        if ( ! get_post_type_object($object_type) ) 
     420                return false; 
     421 
     422        foreach (array_keys($wp_taxonomies['category']->object_type) as $array_key) { 
     423                if ($wp_taxonomies['category']->object_type[$array_key] == 'post') { 
     424                        unset ($wp_taxonomies['category']->object_type[$array_key]); 
     425                        return true; 
     426                } 
     427        } 
     428        return false; 
     429 
     430} 
    400431// 
    401432// Term API 
    402433//