Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_post_format_link() WordPress Function

The post_format_link() function is used to format a link for a post. This function is used by the_post_format_link() function.

_post_format_link( string $link, WP_Term $term, string $taxonomy ) #

Filters the post format term link to remove the format prefix.


Parameters

$link

(string)(Required)

$term

(WP_Term)(Required)

$taxonomy

(string)(Required)


Top ↑

Return

(string)


Top ↑

Source

File: wp-includes/post-formats.php

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


Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.