WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

sync_category_tag_slugs() WP 3.0.0

Synchronizes category and post tag slugs when global terms are enabled.

Хуков нет.


WP_Term/Массив. Returns $term, after filtering the 'slug' field with sanitize_title() if $taxonomy is 'category' or 'post_tag'.


sync_category_tag_slugs( $term, $taxonomy );
$term(WP_Term/массив) (обязательный)
The term.
$taxonomy(строка) (обязательный)
The taxonomy for $term. Should be 'category' or 'post_tag', as these are the only taxonomies which are processed by this function; anything else will be returned untouched.

Список изменений

С версии 3.0.0 Введена.

Код sync_category_tag_slugs() WP 5.5.1

function sync_category_tag_slugs( $term, $taxonomy ) {
	if ( global_terms_enabled() && ( 'category' === $taxonomy || 'post_tag' === $taxonomy ) ) {
		if ( is_object( $term ) ) {
			$term->slug = sanitize_title( $term->name );
		} else {
			$term['slug'] = sanitize_title( $term['name'] );
	return $term;