WordPress函数:is_feed 当前查询是否是 feed

江河/ 2023年09月10日/ WordPress/ 浏览 475

函数原型:


is_feed( string|string[] $feeds = '' ): bool


确定查询是否针对提要-feed。


有关此主题函数和类似主题函数的更多信息,请参阅主题开发人员手册中的条件标记文章。


函数源码:


function is_feed( $feeds = '' ) {
	global $wp_query;

	if ( ! isset( $wp_query ) ) {
		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1.0' );
		return false;
	}

	return $wp_query->is_feed( $feeds );
}


发表评论

暂无评论,抢个沙发...

客服 工单