_post_format_link

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

Description

(string) _post_format_link( (string) $link, (object) $term, (string) $taxonomy ); 

Returns (string)

Parameters (3)

0. $link (string)
The link.
1. $term (object)
The term.
2. $taxonomy (string)
The taxonomy.

Usage

  1. if ( !function_exists( '_post_format_link' ) ) { 
  2. require_once ABSPATH . WPINC . '/post-formats.php'; 
  3.  
  4. // The link. 
  5. $link = ''; 
  6.  
  7. // The term. 
  8. $term = null; 
  9.  
  10. // The taxonomy. 
  11. $taxonomy = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = _post_format_link($link, $term, $taxonomy); 
  15.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/post-formats.php  
  1. function _post_format_link( $link, $term, $taxonomy ) { 
  2. global $wp_rewrite; 
  3. if ( 'post_format' != $taxonomy ) { 
  4. return $link; 
  5. if ( $wp_rewrite->get_extra_permastruct( $taxonomy ) ) { 
  6. return str_replace( "/{$term->slug}", '/' . str_replace( 'post-format-', '', $term->slug ), $link ); 
  7. } else { 
  8. $link = remove_query_arg( 'post_format', $link ); 
  9. return add_query_arg( 'post_format', str_replace( 'post-format-', '', $term->slug ), $link );