_post_format_link

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

WordPress Version: 5.6

/**
 * Filters the post format term link to remove the format prefix.
 *
 * @access private
 * @since 3.1.0
 *
 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
 *
 * @param string  $link
 * @param WP_Term $term
 * @param string  $taxonomy
 * @return string
 */
function _post_format_link($link, $term, $taxonomy)
{
    global $wp_rewrite;
    if ('post_format' !== $taxonomy) {
        return $link;
    }
    if ($wp_rewrite->get_extra_permastruct($taxonomy)) {
        return str_replace("/{$term->slug}", '/' . str_replace('post-format-', '', $term->slug), $link);
    } else {
        $link = remove_query_arg('post_format', $link);
        return add_query_arg('post_format', str_replace('post-format-', '', $term->slug), $link);
    }
}

WordPress Version: 5.5

/**
 * Filters the post format term link to remove the format prefix.
 *
 * @access private
 * @since 3.1.0
 *
 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
 *
 * @param string $link
 * @param object $term
 * @param string $taxonomy
 * @return string
 */
function _post_format_link($link, $term, $taxonomy)
{
    global $wp_rewrite;
    if ('post_format' !== $taxonomy) {
        return $link;
    }
    if ($wp_rewrite->get_extra_permastruct($taxonomy)) {
        return str_replace("/{$term->slug}", '/' . str_replace('post-format-', '', $term->slug), $link);
    } else {
        $link = remove_query_arg('post_format', $link);
        return add_query_arg('post_format', str_replace('post-format-', '', $term->slug), $link);
    }
}

WordPress Version: 5.3

/**
 * Filters the post format term link to remove the format prefix.
 *
 * @access private
 * @since 3.1.0
 *
 * @global WP_Rewrite $wp_rewrite WordPress rewrite component.
 *
 * @param string $link
 * @param object $term
 * @param string $taxonomy
 * @return string
 */
function _post_format_link($link, $term, $taxonomy)
{
    global $wp_rewrite;
    if ('post_format' != $taxonomy) {
        return $link;
    }
    if ($wp_rewrite->get_extra_permastruct($taxonomy)) {
        return str_replace("/{$term->slug}", '/' . str_replace('post-format-', '', $term->slug), $link);
    } else {
        $link = remove_query_arg('post_format', $link);
        return add_query_arg('post_format', str_replace('post-format-', '', $term->slug), $link);
    }
}

WordPress Version: 4.3

/**
 * Filters the post format term link to remove the format prefix.
 *
 * @access private
 * @since 3.1.0
 *
 * @global WP_Rewrite $wp_rewrite
 *
 * @param string $link
 * @param object $term
 * @param string $taxonomy
 * @return string
 */
function _post_format_link($link, $term, $taxonomy)
{
    global $wp_rewrite;
    if ('post_format' != $taxonomy) {
        return $link;
    }
    if ($wp_rewrite->get_extra_permastruct($taxonomy)) {
        return str_replace("/{$term->slug}", '/' . str_replace('post-format-', '', $term->slug), $link);
    } else {
        $link = remove_query_arg('post_format', $link);
        return add_query_arg('post_format', str_replace('post-format-', '', $term->slug), $link);
    }
}

WordPress Version: 3.7

/**
 * Filters the post format term link to remove the format prefix.
 *
 * @access private
 * @since 3.1.0
 */
function _post_format_link($link, $term, $taxonomy)
{
    global $wp_rewrite;
    if ('post_format' != $taxonomy) {
        return $link;
    }
    if ($wp_rewrite->get_extra_permastruct($taxonomy)) {
        return str_replace("/{$term->slug}", '/' . str_replace('post-format-', '', $term->slug), $link);
    } else {
        $link = remove_query_arg('post_format', $link);
        return add_query_arg('post_format', str_replace('post-format-', '', $term->slug), $link);
    }
}