in_the_loop

函数


in_the_loop ( No parameters )
返回值
  • (bool) True if caller is within loop, false if loop hasn’t started or ended.
定义位置
  • wp-includes/query.php
    , line 963
引入
2.0.0
弃用

判断调用器是否在循环中。

关于这个和类似的主题函数的更多信息,请查看《主题开发者手册》中的{@link Conditional Tags}文章。

function in_the_loop() {
	global $wp_query;

	if ( ! isset( $wp_query ) ) {
		return false;
	}

	return $wp_query->in_the_loop;
}