wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes



wp_create_term › WordPress Function

Depuis2.8.0
Dépréciéen/a
wp_create_term ( $tag_name, $taxonomy = 'post_tag' )
Paramètres: (2)
  • (string) $tag_name The term name.
    Requis: Oui
  • (string) $taxonomy Optional. The taxonomy within which to create the term. Default 'post_tag'.
    Requis: Non
    Défaut: 'post_tag'
Retourne:
  • (array|WP_Error)
Défini(e) dans:
Codex:

Adds a new term to the database if it does not already exist.



Source

function wp_create_term( $tag_name, $taxonomy = 'post_tag' ) {
	$id = term_exists( $tag_name, $taxonomy );
	if ( $id ) {
		return $id;
	}

	return wp_insert_term( $tag_name, $taxonomy );
}