WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to tell if plugin template tag is within The Loop? (3 posts)

  1. micropat
    Member
    Posted 5 years ago #

    Our plugin provides a template tag.

    Is there a way to tell if that template tag is within The Loop?

    We tried variation of if ( $post ) but it appears that $post is available even after the loop ends.

    Any ideas on how to know if we're within The Loop?

  2. taffeljohan
    Member
    Posted 5 years ago #

    Use in_the_loop(). Defined in query.php.

  3. micropat
    Member
    Posted 5 years ago #

    Thank you, in_the_loop() is exactly what I was looking for!

    We need to get this in WP docs regarding The Loop. :)

Topic Closed

This topic has been closed to new replies.

About this Topic