wpseek.com
A WordPress-centric search engine for devs and theme authors



in_the_loop › WordPress Function

Since2.0.0
Deprecatedn/a
in_the_loop ( No parameters )
Returns:
  • (bool) True if caller is within loop, false if loop hasn't started or ended.
Defined at:
Codex:

Determines whether the caller is in the Loop.

For more information on this and similar theme functions, check out the {@link Conditional Tags} article in the Theme Developer Handbook.


Source

function in_the_loop() {
	global $wp_query;

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

	return $wp_query->in_the_loop;
}