bbp_filter_sample_permalink

Filter sample permalinks so that certain languages display properly.

Description

(string) bbp_filter_sample_permalink( (string) $post_link, (object) $_post, (constant) $leavename = false, (bool) $sample = false ); 

Returns (string)

The custom post type permalink

Parameters (4)

0. $post_link (string)
Custom post type permalink
1. $post (object)
Post data object
2. $leavename — Optional. (constant) => false
Optional, defaults to false. Whether to keep post name or page name.
3. $sample — Optional. (bool) => false
Optional, defaults to false. Is it a sample permalink.

Usage

  1. if ( !function_exists( 'bbp_filter_sample_permalink' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'bbpress/includes/admin/functions.php'; 
  3.  
  4. // Custom post type permalink 
  5. $post_link = ''; 
  6.  
  7. // Post data object 
  8. $post = null; 
  9.  
  10. // Optional, defaults to false. Whether to keep post name or page name. 
  11. $leavename = false; 
  12.  
  13. // Optional, defaults to false. Is it a sample permalink. 
  14. $sample = false; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = bbp_filter_sample_permalink($post_link, $post, $leavename, $sample); 
  18.  

Defined (1)

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

/includes/admin/functions.php  
  1. function bbp_filter_sample_permalink( $post_link, $_post, $leavename = false, $sample = false ) { 
  2.  
  3. // Bail if not on an admin page and not getting a sample permalink 
  4. if ( !empty( $sample ) && is_admin() && bbp_is_custom_post_type() ) 
  5. return urldecode( $post_link ); 
  6.  
  7. // Return post link 
  8. return $post_link;