sync_category_tag_slugs

The timeline below displays how wordpress function sync_category_tag_slugs has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.1

/**
 * Synchronizes category and post tag slugs when global terms are enabled.
 *
 * @since 3.0.0
 * @since 6.1.0 This function no longer does anything.
 * @deprecated 6.1.0
 *
 * @param WP_Term|array $term     The term.
 * @param string        $taxonomy The taxonomy for `$term`.
 * @return WP_Term|array Always returns `$term`.
 */
function sync_category_tag_slugs($term, $taxonomy)
{
    _deprecated_function(__FUNCTION__, '6.1.0');
    return $term;
}

WordPress Version: 5.4

/**
 * Synchronizes category and post tag slugs when global terms are enabled.
 *
 * @since 3.0.0
 *
 * @param WP_Term|array $term     The term.
 * @param string        $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.
 * @return WP_Term|array Returns `$term`, after filtering the 'slug' field with `sanitize_title()`
 *                       if `$taxonomy` is 'category' or 'post_tag'.
 */
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;
}

WordPress Version: 5.1

/**
 * Synchronizes category and post tag slugs when global terms are enabled.
 *
 * @since 3.0.0
 *
 * @param WP_Term|array $term     The term.
 * @param string        $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.
 * @return WP_Term|array Returns `$term`, after filtering the 'slug' field with `sanitize_title()`
 *                       if `$taxonomy` is 'category' or 'post_tag'.
 */
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;
}

WordPress Version: 4.6

/**
 * Synchronize category and post tag slugs when global terms are enabled.
 *
 * @since 3.0.0
 *
 * @param object $term     The term.
 * @param string $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.
 * @return object|array Returns `$term`, after filtering the 'slug' field with sanitize_title()
 *                      if $taxonomy is 'category' or 'post_tag'.
 */
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;
}

WordPress Version: 4.2

/**
 * Synchronize category and post tag slugs when global terms are enabled.
 *
 * @since 3.0.0
 *
 * @param object $term     The term.
 * @param string $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.
 * @return object|array Returns `$term`, after filtering the 'slug' field with {@see sanitize_title()}
 *                      if $taxonomy is 'category' or 'post_tag'.
 */
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;
}

WordPress Version: 4.1

/**
 * Synchronize category and post tag slugs when global terms are enabled.
 *
 * @since 3.0.0
 *
 * @param $term     The term.
 * @param $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.
 * @return object|array Returns `$term`, after filtering the 'slug' field with {@see sanitize_title()}
 *                      if $taxonomy is 'category' or 'post_tag'.
 */
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;
}

WordPress Version: 3.7

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