Is $page a global variable in wordpress?

Yes. It is an “inside the Loop” global. $page (int) The page of the post, as specified by the query var page. http://codex.wordpress.org/Global_Variables 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 … Read more

Override global query results without hooks

It is quite hard to understand what you need to do here, but you need to look at the following Do not use the global variables as local variables, it breaks the global variables and causes issues with the loop. It is also quite hard to debug when you run into issues. The only global … Read more

Call global variable array() in woocommerce child/template

It is all fine. You just need to declare variable global first then you can set the value of this and access globally. function my_free_shipping( $is_available ) { global $woocommerce, $product_notfree_ship; // set the product ids that are $product_notfree_ship $product_notfree_ship = array( ‘1’, ‘2’, ‘3’, ‘4’, ‘5’ ); Then again declare it globally when using … Read more

Ajax Pagination on Ajax filter

As @Milo brilliantly pointed out, there is no such a thing like a global query object in WordPress. So I’ve solved the problem via JS, like this: var isFiltered = false; var filters; $(load_more_button).click(function(e) { load_more_handler(e); }); $(filters_form).submit(function(e) { filter_handler(e); }); function filter_handler(e) { isFiltered = true; filters = $(this).serialize(); var data = { action: … Read more