sync_category_tag_slugs( object $term, string $taxonomy )

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


Description Description


Parameters Parameters

$term

(object) (Required) The term.

$taxonomy

(string) (Required) 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.


Top ↑

Return Return

(object|array) Returns $term, after filtering the 'slug' field with sanitize_title() if $taxonomy is 'category' or 'post_tag'.


Top ↑

Source Source

File: wp-admin/includes/ms.php

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

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.