get_search_feed_link()
get_search_feed_link( string $search_query = ”, string …
get_search_feed_link( string $search_query = ”,  string $feed = ” )
检索搜索结果源的永久链接。
Retrieves the permalink for the search results feed.
检索搜索结果源的永久链接。
Retrieves the permalink for the search results feed.
目录锚点:#参数#返回#源码
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| $search_query | (string) | 可选 | 搜索查询。 | 
| $feed | (string) | 可选 | 进给类型。可能的值包括“rss2”、“atom”。Default是get_Default_feed()的值。 | 
返回(Return)
(string)搜索结果馈送permalink。
源码(Source)
/**
 * Retrieve the permalink for the feed of the search results.
 *
 * @since 2.5.0
 *
 * @global WP_Rewrite $wp_rewrite
 *
 * @param string $search_query Optional. Search query.
 * @param string $feed         Optional. Feed type.
 * @return string The search results feed permalink.
 */
function get_search_feed_link($search_query = '', $feed = '') {
	global $wp_rewrite;
	$link = get_search_link($search_query);
	if ( empty($feed) )
		$feed = get_default_feed();
	$permastruct = $wp_rewrite->get_search_permastruct();
	if ( empty($permastruct) ) {
		$link = add_query_arg('feed', $feed, $link);
	} else {
		$link = trailingslashit($link);
		$link .= "feed/$feed/";
	}
	/**
	 * Filter the search feed link.
	 *
	 * @since 2.5.0
	 *
	 * @param string $link Search feed link.
	 * @param string $feed Feed type.
	 * @param string $type The search type. One of 'posts' or 'comments'.
	 */
	return apply_filters( 'search_feed_link', $link, $feed, 'posts' );
}| 更新版本 | 源码位置 | 使用 | 被使用 | 
|---|---|---|---|
| 2.5.0 | wp-includes/link-template.php:1140 | 2 | 7 | 
类别:WordPress 函数手册、 
		本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。


还没有任何评论,赶紧来占个楼吧!