wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_set_post_terms › WordPress Function
Seit2.8.0
Veraltetn/v
› wp_set_post_terms ( $post_id = 0, $terms = '', $taxonomy = 'post_tag', $append = false )
Parameter: (4) |
|
Siehe: | |
Gibt zurück: |
|
Definiert in: |
|
Codex: |
Sets the terms for a post.
Ähnliche Funktionen: wp_get_post_terms, wp_set_post_cats, wp_set_post_tags, wp_set_object_terms, wp_set_post_categories
Quellcode
function wp_set_post_terms( $post_id = 0, $terms = '', $taxonomy = 'post_tag', $append = false ) { $post_id = (int) $post_id; if ( ! $post_id ) { return false; } if ( empty( $terms ) ) { $terms = array(); } if ( ! is_array( $terms ) ) { $comma = _x( ',', 'tag delimiter' ); if ( ',' !== $comma ) { $terms = str_replace( $comma, ',', $terms ); } $terms = explode( ',', trim( $terms, " \n\t\r\0\x0B," ) ); } /* * Hierarchical taxonomies must always pass IDs rather than names so that * children with the same names but different parents aren't confused. */ if ( is_taxonomy_hierarchical( $taxonomy ) ) { $terms = array_unique( array_map( 'intval', $terms ) ); } return wp_set_object_terms( $post_id, $terms, $taxonomy, $append ); }