wpseek.com
Uma área de pesquisa sobre o WordPress para devs e autores do tema



wp_create_term › WordPress Function

Desde2.8.0
Obsoleton/a
wp_create_term ( $tag_name, $taxonomy = 'post_tag' )
Parâmetros: (2)
  • (string) $tag_name The term name.
    Required: Yes
  • (string) $taxonomy Optional. The taxonomy within which to create the term. Default 'post_tag'.
    Required: No
    Padrão: 'post_tag'
Retorna:
  • (array|WP_Error)
Definido em:
Codex:

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



Fonte

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 );
}