Title: _post_format_link
Published: April 25, 2014
Last modified: February 24, 2026

---

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

## In this article

 * [Parameters](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#wp--skip-link--target)

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

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

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#parameters)󠁿

 `$link`stringrequired

`$term`[WP_Term](https://developer.wordpress.org/reference/classes/wp_term/)required

`$taxonomy`stringrequired

## 󠀁[Return](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#return)󠁿

 string

## 󠀁[Source](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#source)󠁿

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

[View all references](https://developer.wordpress.org/reference/files/wp-includes/post-formats.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/post-formats.php#L194)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/post-formats.php#L194-L205)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#related)󠁿

| Uses | Description | 
| [remove_query_arg()](https://developer.wordpress.org/reference/functions/remove_query_arg/)`wp-includes/functions.php` |

Removes an item or items from a query string.

  | 
| [WP_Rewrite::get_extra_permastruct()](https://developer.wordpress.org/reference/classes/wp_rewrite/get_extra_permastruct/)`wp-includes/class-wp-rewrite.php` |

Retrieves an extra permalink structure by name.

  | 
| [add_query_arg()](https://developer.wordpress.org/reference/functions/add_query_arg/)`wp-includes/functions.php` |

Retrieves a modified URL query string.

  |

[Show 1 more](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/_post_format_link/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2F_post_format_link%2F)
before being able to contribute a note or feedback.