Changeset 12597 for trunk/wp-includes/taxonomy.php
- Timestamp:
- 01/04/2010 04:58:43 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/taxonomy.php
r12515 r12597 181 181 } 182 182 183 if ( false !== $args['rewrite'] && !empty($wp_rewrite) ) {183 if ( false !== $args['rewrite'] && '' != get_option('permalink_structure') ) { 184 184 if ( !is_array($args['rewrite']) ) 185 185 $args['rewrite'] = array(); … … 187 187 $args['rewrite']['slug'] = sanitize_title_with_dashes($taxonomy); 188 188 $wp_rewrite->add_rewrite_tag("%$taxonomy%", '([^/]+)', $args['query_var'] ? "{$args['query_var']}=" : "taxonomy=$taxonomy&term=$term"); 189 $wp_rewrite->add_permastruct($taxonomy, " {$args['rewrite']['slug']}/%$taxonomy%");189 $wp_rewrite->add_permastruct($taxonomy, "/{$args['rewrite']['slug']}/%$taxonomy%"); 190 190 } 191 191 192 192 $args['name'] = $taxonomy; 193 $args['object_type'] = $object_type;193 $args['object_type'] = (array) $object_type; 194 194 $wp_taxonomies[$taxonomy] = (object) $args; 195 } 196 197 /** 198 * Add an already registered taxonomy to an object type. 199 * 200 * @package WordPress 201 * @subpackage Taxonomy 202 * @since 3.0 203 * @uses $wp_taxonomies Modifies taxonomy object 204 * 205 * @param string $taxonomy Name of taxonomy object 206 * @param array|string $object_type Name of the object type 207 * @return bool True if successful, false if not 208 */ 209 function register_taxonomy_for_object_type( $taxonomy, $object_type) { 210 global $wp_taxonomies; 211 212 if ( !isset($wp_taxonomies[$taxonomy]) ) 213 return false; 214 215 if ( ! get_post_type_object($object_type) ) 216 return false; 217 218 $wp_taxonomies[$taxonomy]->object_type[] = $object_type; 219 220 return true; 195 221 } 196 222 … … 2379 2405 } 2380 2406 2407 /** 2408 * Determine if the given object type is associated with the given taxonomy. 2409 * 2410 * @since 3.0 2411 * @uses get_object_taxonomies() 2412 * 2413 * @param string $object_type Object type string 2414 * @param string $taxonomy. Single taxonomy name 2415 * @return bool True if object is associated with the taxonomy, otherwise false. 2416 */ 2417 function is_object_in_taxonomy($object_type, $taxonomy) { 2418 $taxonomies = get_object_taxonomies($object_type); 2419 2420 if ( empty($taxonomies) ) 2421 return false; 2422 2423 if ( in_array($taxonomy, $taxonomies) ) 2424 return true; 2425 2426 return false; 2427 } 2428 2381 2429 ?>
Note: See TracChangeset
for help on using the changeset viewer.