get_search_comments_feed_link

函式
get_search_comments_feed_link ( $search_query = '', $feed = '' )
引數
  • (string) $search_query Optional. Search query. Default empty.
    Required:
    Default: (empty)
  • (string) $feed Optional. Feed type. Possible values include 'rss2', 'atom'. Default is the value of get_default_feed().
    Required:
    Default: (empty)
返回值
  • (string) The comments feed search results permalink.
定義位置
相關方法
get_post_comments_feed_linkget_search_feed_linkpost_comments_feed_linkget_next_comments_linkget_comments_link
引入
2.5.0
棄用
-

get_search_comments_feed_link函式是WordPress的一個函式,用於檢索一個搜尋查詢的評論feed的URL: 這個函式接受一個搜尋查詢的可選引數,並返回搜尋查詢的評論源的URL。

檢索搜尋結果評論區的固定連結。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_search_comments_feed_link( $search_query = '', $feed = '' ) {
global $wp_rewrite;
if ( empty( $feed ) ) {
$feed = get_default_feed();
}
$link = get_search_feed_link( $search_query, $feed );
$permastruct = $wp_rewrite->get_search_permastruct();
if ( empty( $permastruct ) ) {
$link = add_query_arg( 'feed', 'comments-' . $feed, $link );
} else {
$link = add_query_arg( 'withcomments', 1, $link );
}
/** This filter is documented in wp-includes/link-template.php */
return apply_filters( 'search_feed_link', $link, $feed, 'comments' );
}
function get_search_comments_feed_link( $search_query = '', $feed = '' ) { global $wp_rewrite; if ( empty( $feed ) ) { $feed = get_default_feed(); } $link = get_search_feed_link( $search_query, $feed ); $permastruct = $wp_rewrite->get_search_permastruct(); if ( empty( $permastruct ) ) { $link = add_query_arg( 'feed', 'comments-' . $feed, $link ); } else { $link = add_query_arg( 'withcomments', 1, $link ); } /** This filter is documented in wp-includes/link-template.php */ return apply_filters( 'search_feed_link', $link, $feed, 'comments' ); }
function get_search_comments_feed_link( $search_query = '', $feed = '' ) {
	global $wp_rewrite;

	if ( empty( $feed ) ) {
		$feed = get_default_feed();
	}

	$link = get_search_feed_link( $search_query, $feed );

	$permastruct = $wp_rewrite->get_search_permastruct();

	if ( empty( $permastruct ) ) {
		$link = add_query_arg( 'feed', 'comments-' . $feed, $link );
	} else {
		$link = add_query_arg( 'withcomments', 1, $link );
	}

	/** This filter is documented in wp-includes/link-template.php */
	return apply_filters( 'search_feed_link', $link, $feed, 'comments' );
}

常見問題

FAQs
檢視更多 >