WordPress at a glance

in_the_loop() WP 1.0

Whether the caller is in the Loop.

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

  • Global. WP_Query. $wp_query Global WP_Query instance.

No Hooks.


true/false. True if caller is within loop, false if loop hasn't started or ended.



Code of in the loop: wp-includes/query.php VER 5.1.1

function in_the_loop() {
	global $wp_query;
	return $wp_query->in_the_loop;

Related Functions

From tag: Conditional tags (all)

More from category: Queries

More from Template Tags: Posts, Pages, ...

No comments
    Hello, !     Log In . Register