I am having a problem with a local $page variable, especially when using it in The Loop. Is it a reserved variable of Wordpress? Also where can I find a list of all those global variables?

2 Answers 2


Yes. It is an "inside the Loop" global.

$page (int) The page of the post, as specified by the query var page.


It is setup and used by setup_postdata which executes at every iteration of a standard Loop. Though meant for use inside the Loop, the variable would still be set after the Loop to the last data it was given (unless specifically unset and I don't think it is, but am not swearing to that).

  • But how can a variable become global only in a loop?
    – user25893
    Oct 3, 2013 at 22:26
  • the_post() initializes them?
    – user25893
    Oct 3, 2013 at 22:28
  • 2
    @Maxwell : see the edit
    – s_ha_dum
    Oct 3, 2013 at 22:35

The wordpress codex is definitely your friend finding such information... :) and, yes, $post is one of wordpress's Global Variables.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy