get_search_comments_feed_link

Retrieves the permalink for the search results comments feed.

Description

(string) get_search_comments_feed_link( (string) $search_query = '', (string) $feed = '' ); 

Returns (string)

The comments feed search results permalink.

Parameters (2)

0. $search_query — Optional. (string) => ''
Search query. Default empty.
1. $feed — Optional. (string) => ''
Feed type. Default empty.

Usage

  1. if ( !function_exists( 'get_search_comments_feed_link' ) ) { 
  2. require_once ABSPATH . WPINC . '/link-template.php'; 
  3.  
  4. // Optional. Search query. Default empty. 
  5. $search_query = ''; 
  6.  
  7. // Optional. Feed type. Default empty. 
  8. $feed = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = get_search_comments_feed_link($search_query, $feed); 
  12.  

Defined (1)

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

/wp-includes/link-template.php  
  1. function get_search_comments_feed_link($search_query = '', $feed = '') { 
  2. global $wp_rewrite; 
  3.  
  4. if ( empty($feed) ) 
  5. $feed = get_default_feed(); 
  6.  
  7. $link = get_search_feed_link($search_query, $feed); 
  8.  
  9. $permastruct = $wp_rewrite->get_search_permastruct(); 
  10.  
  11. if ( empty($permastruct) ) 
  12. $link = add_query_arg('feed', 'comments-' . $feed, $link); 
  13. else 
  14. $link = add_query_arg('withcomments', 1, $link); 
  15.  
  16. /** This filter is documented in wp-includes/link-template.php */ 
  17. return apply_filters( 'search_feed_link', $link, $feed, 'comments' );