wpseek.com
Un motore di ricerca WordPress per sviluppatori e autori di temi



category_exists › WordPress Function

Da2.0.0
Deprecaton/a
category_exists ( $cat_name, $category_parent = null )
Parametri: (2)
  • (int|string) $cat_name Category name.
    Richiesto:
  • (int) $category_parent Optional. ID of parent category.
    Richiesto: No
    Default: null
Vedi:
Ritorna:
  • (string|null) Returns the category ID as a numeric string if the pairing exists, null if not.
Definito a:
Codex:

Checks whether a category exists.



Sorgenti

function category_exists( $cat_name, $category_parent = null ) {
	$id = term_exists( $cat_name, 'category', $category_parent );
	if ( is_array( $id ) ) {
		$id = $id['term_id'];
	}
	return $id;
}