diff --git wp-includes/post.php wp-includes/post.php
index cea834b..fc4c7cb 100644
|
|
function wp_get_single_post($postid = 0, $mode = OBJECT) { |
2328 | 2328 | ) |
2329 | 2329 | return ( OBJECT == $mode ? null : array() ); |
2330 | 2330 | |
| 2331 | // get custom taxonomies |
| 2332 | $taxonomies = get_object_taxonomies( $post, 'names', true ); |
| 2333 | $tax_input = array(); |
| 2334 | |
| 2335 | if ( ! empty( $taxonomies ) ) { |
| 2336 | foreach ( $taxonomies as $taxonomy ) { |
| 2337 | $post_terms = wp_get_post_terms( $postid, $taxonomy, array( 'fields' => 'ids' ) ); |
| 2338 | if ( ! empty( $post_terms ) ) |
| 2339 | $tax_input[$taxonomy] = $post_terms; |
| 2340 | } |
| 2341 | } |
| 2342 | |
2331 | 2343 | // Set categories and tags |
2332 | 2344 | if ( $mode == OBJECT ) { |
2333 | 2345 | $post->post_category = array(); |
… |
… |
function wp_get_single_post($postid = 0, $mode = OBJECT) { |
2336 | 2348 | $post->tags_input = array(); |
2337 | 2349 | if ( is_object_in_taxonomy($post->post_type, 'post_tag') ) |
2338 | 2350 | $post->tags_input = wp_get_post_tags($postid, array('fields' => 'names')); |
| 2351 | $post->tax_input = $tax_input; |
2339 | 2352 | } else { |
2340 | 2353 | $post['post_category'] = array(); |
2341 | 2354 | if ( is_object_in_taxonomy($post['post_type'], 'category') ) |
… |
… |
function wp_get_single_post($postid = 0, $mode = OBJECT) { |
2343 | 2356 | $post['tags_input'] = array(); |
2344 | 2357 | if ( is_object_in_taxonomy($post['post_type'], 'post_tag') ) |
2345 | 2358 | $post['tags_input'] = wp_get_post_tags($postid, array('fields' => 'names')); |
| 2359 | $post['tax_input'] = $tax_input; |
2346 | 2360 | } |
2347 | | |
2348 | 2361 | return $post; |
2349 | 2362 | } |
2350 | 2363 | |
diff --git wp-includes/taxonomy.php wp-includes/taxonomy.php
index 60068c5..e678c9a 100644
|
|
function get_taxonomies( $args = array(), $output = 'names', $operator = 'and' ) |
140 | 140 | * |
141 | 141 | * @param array|string|object $object Name of the type of taxonomy object, or an object (row from posts) |
142 | 142 | * @param string $output The type of output to return, either taxonomy 'names' or 'objects'. 'names' is the default. |
| 143 | * @param bool $exclude_builtin Specify <code>true</code> to return only custom taxonomies. <code>false</code> is the default. |
143 | 144 | * @return array The names of all taxonomy of $object_type. |
144 | 145 | */ |
145 | | function get_object_taxonomies($object, $output = 'names') { |
| 146 | function get_object_taxonomies($object, $output = 'names', $exclude_builtin = false) { |
146 | 147 | global $wp_taxonomies; |
147 | 148 | |
148 | 149 | if ( is_object($object) ) { |
… |
… |
function get_object_taxonomies($object, $output = 'names') { |
155 | 156 | |
156 | 157 | $taxonomies = array(); |
157 | 158 | foreach ( (array) $wp_taxonomies as $tax_name => $tax_obj ) { |
| 159 | if ( $exclude_builtin && $tax_obj->_builtin ) |
| 160 | continue; |
158 | 161 | if ( array_intersect($object, (array) $tax_obj->object_type) ) { |
159 | 162 | if ( 'names' == $output ) |
160 | 163 | $taxonomies[] = $tax_name; |
… |
… |
function is_taxonomy_hierarchical($taxonomy) { |
256 | 259 | * boolean value. |
257 | 260 | * |
258 | 261 | * update_count_callback - works much like a hook, in that it will be called |
259 | | * when the count is updated. |
| 262 | * when the count is updated; if not defined and show_ui is true, defaults to '_update_post_term_count'. |
| 263 | * To suppress default callback in any cases, set update_count_callback to false. |
260 | 264 | * |
261 | 265 | * rewrite - false to prevent rewrite, or array('slug'=>$slug) to customize |
262 | 266 | * permastruct; default will use $taxonomy as slug. |
… |
… |
function register_taxonomy( $taxonomy, $object_type, $args = array() ) { |
335 | 339 | if ( is_null($args['show_ui']) ) |
336 | 340 | $args['show_ui'] = $args['public']; |
337 | 341 | |
| 342 | if ( $args['show_ui'] && $args['update_count_callback'] === '' ) { |
| 343 | $args['update_count_callback'] = '_update_post_term_count'; |
| 344 | } |
| 345 | |
338 | 346 | // Whether to show this type in nav-menus.php. Defaults to the setting for public. |
339 | 347 | if ( null === $args['show_in_nav_menus'] ) |
340 | 348 | $args['show_in_nav_menus'] = $args['public']; |