Changeset 10222 for trunk/wp-includes/post.php
- Timestamp:
- 12/18/2008 07:12:26 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r10213 r10222 1207 1207 */ 1208 1208 function wp_get_post_tags( $post_id = 0, $args = array() ) { 1209 return wp_get_post_terms( $post_id, 'post_tag', $args); 1210 } 1211 1212 /** 1213 * Retrieve the terms for a post. 1214 * 1215 * There is only one default for this function, called 'fields' and by default 1216 * is set to 'all'. There are other defaults that can be override in 1217 * {@link wp_get_object_terms()}. 1218 * 1219 * @package WordPress 1220 * @subpackage Post 1221 * @since 2.8.0 1222 * 1223 * @uses wp_get_object_terms() Gets the tags for returning. Args can be found here 1224 * 1225 * @param int $post_id Optional. The Post ID 1226 * @param string $taxonomy The taxonomy for which to retrieve terms. Defaults to post_tag. 1227 * @param array $args Optional. Overwrite the defaults 1228 * @return array List of post tags. 1229 */ 1230 function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) { 1209 1231 $post_id = (int) $post_id; 1210 1232 … … 1212 1234 $args = wp_parse_args( $args, $defaults ); 1213 1235 1214 $tags = wp_get_object_terms($post_id, 'post_tag', $args);1236 $tags = wp_get_object_terms($post_id, $taxonomy, $args); 1215 1237 1216 1238 return $tags; … … 1499 1521 1500 1522 wp_set_post_categories( $post_ID, $post_category ); 1501 wp_set_post_tags( $post_ID, $tags_input ); 1523 // old-style tags_input 1524 if ( !empty($tags_input) ) 1525 wp_set_post_tags( $post_ID, $tags_input ); 1526 // new-style support for all tag-like taxonomies 1527 if ( !empty($tax_input) ) { 1528 foreach ( $tax_input as $taxonomy => $tags ) { 1529 wp_set_post_terms( $post_ID, $tags, $taxonomy ); 1530 } 1531 } 1502 1532 1503 1533 $current_guid = get_post_field( 'guid', $post_ID ); … … 1686 1716 */ 1687 1717 function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) { 1688 1718 return wp_set_post_terms( $post_id, $tags, 'post_tag', $append); 1719 } 1720 1721 /** 1722 * Set the terms for a post. 1723 * 1724 * @since 2.8.0 1725 * @uses wp_set_object_terms() Sets the tags for the post. 1726 * 1727 * @param int $post_id Post ID. 1728 * @param string $tags The tags to set for the post, separated by commas. 1729 * @param bool $append If true, don't delete existing tags, just add on. If false, replace the tags with the new tags. 1730 * @return bool|null Will return false if $post_id is not an integer or is 0. Will return null otherwise 1731 */ 1732 function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) { 1689 1733 $post_id = (int) $post_id; 1690 1734 … … 1694 1738 if ( empty($tags) ) 1695 1739 $tags = array(); 1696 $tags = (is_array($tags)) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") ); 1697 wp_set_object_terms($post_id, $tags, 'post_tag', $append); 1740 1741 $tags = is_array($tags) ? $tags : explode( ',', trim($tags, " \n\t\r\0\x0B,") ); 1742 wp_set_object_terms($post_id, $tags, $taxonomy, $append); 1698 1743 } 1699 1744
Note: See TracChangeset
for help on using the changeset viewer.