wp_set_post_terms [ WordPress Function ]
wp_set_post_terms ( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false )
| Parameters: |
|
| Uses: | |
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: wp_get_post_terms, wp_set_post_cats, wp_set_post_tags, wp_set_object_terms, wp_set_post_categories
Set the terms for a post.
Source
<?php
function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) {
$post_id = (int) $post_id;
if ( !$post_id )
return false;
if ( empty($tags) )
$tags = array();
if ( ! is_array( $tags ) ) {
$comma = _x( ',', 'tag delimiter' );
if ( ',' !== $comma )
$tags = str_replace( $comma, ',', $tags );
$tags = explode( ',', trim( $tags, " \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 ) ) {
$tags = array_map( 'intval', $tags );
$tags = array_unique( $tags );
}
return wp_set_object_terms($post_id, $tags, $taxonomy, $append);
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- Function Reference/wp set post terms « WordPress Codex
Description. Set terms for a post. Uses wp_set_object_terms() . Usage. <?php wp_set_post_terms( $post_ID, $terms, $taxonomy, $append ) ?> Parameters ...
codex.wordpress.org - WordPress › Support » wp_set_post_terms()
Hello,. I'm working on a custom taxon plugin and I'm making use of wp_set_post_terms(). If I'm not mistaken, with the fourth parameter ($append) left off, ...
wordpress.org - custom taxonomy - wp_set_post_terms example? - WordPress
Jul 24, 2011 ... Do you know of a great wp_set_post_terms example? ... I think you're looking for wp_set_post_terms() – One Trick Pony Jul 24 '11 at 13:53 ...
wordpress.stackexchange.com - wordpress - wp_set_post_terms is not updating the count column in ...
Jan 31, 2012 ... wp_set_post_terms($post_ID, 'my_term', 'my_taxonomy');. My problem is that in wp_term_taxonomy, the count is 0 but running that line of code ...
stackoverflow.com
Gebruikersdiscussies [ wordpress.org ]
- mediabros on "wp_set_post_terms, example needed"
- jnhghy on "wp_set_post_terms, example needed"
- mediabros on "wp_set_post_terms, example needed"
- casben79 on "my add cathegory code does not work in 3.0.1"
- scrollpost on "Taxonomy anomaly"
- ddeconin on "my add cathegory code does not work in 3.0.1"
- ddeconin on "my add cathegory code does not work in 3.0.1"
- mrmist on "How to set custom post terms for new post in P2?"
- James on "How to set custom post terms for new post in P2?"
- parandroid on "How to set custom post terms for new post in P2?"