I think I figured it out. Most of WordPress is based on global variables. Even the main loop is pulling a giant global variable. So I guess it’s ok since I’m not modifying the actual values here – just pulling it out. It might not be a bad idea to throw $numpages and $page into new variables and then call those new variables to prevent accidental modification of their global versions.
Related Posts:
- How to: inspect global variables in WordPress
- get_post() vs global $post or $GLOBAL[‘post’]
- How to deal with global information without creating a Singleton class
- Using global $post v/s $GLOBALS[‘post’]
- Accessing $post global on a custom post type archive page
- get_query_var vs global query variables?
- What is the global $wp object used for?
- Change global values from templates
- Will $current_user no longer be global?
- How to avoid repeatedly use the new statement to instantiate a class? [closed]
- Is $page a global variable in wordpress?
- How can i use a global variable in a .css file generated with php?
- Current page id returns the incorrect value
- Echo get_the_category() outside of loop (global?)
- How does WordPress make its functions globally available?
- Recommendations on accessing current user data in WordPress
- WP user agent returns random variables
- How to get particular data from wp_list_comments outside the loop?
- How to save a viewer specific option
- What is the correct way to obtain access to the WP_oEmbed object?
- $GLOBALS[‘value1’] is not working
- Creating a (global)-mapping
- wp localize script makes variable global, how to solve that?
- Is there a way to natively return the full filesystem path when using $wp_styles?
- How to set and use global variables? Or why not to use them at all
- Should we trust the post globals?
- WordPress Multisite – global categories
- How to pass arguments from add_settings_field() to the callback function?
- Paged posts – how to use numbers and next/previous links?
- What is a good alternative to using $content_width for image optimization?
- Passing variables from header.php to template and vice verca
- When to use global $post and other global variables?
- What is $post_id? is it a global variable in WordPress?
- WordPress Theme variables scope
- Any advantage of using wp_scripts and is_IE when enqueuing scripts
- Reducing the use of global $post
- Does an activated plugin automatically mean its methods are available to other WP functions?
- Where to get information about array fields in $_REQUEST?
- Global Objects and Public Methods
- Custom plugin: Trying to show saved data on frontend
- How to call a function only once (global variable scope)
- What is the difference between using global $current_screen and get_current_screen()?
- Why declare $post globally?
- Create a global variable for use in all templates
- When and Where is `global $post` Set and Available?
- Registering AJAX callback function that is part of a class without instantiating the class in function.php
- Filtered query_vars becomes global. Why does this work?
- query_posts() in function makes global $wp_query out of sync?
- Automatically add after X number of paragraphs
- Single Page View for Paginated Posts
- How to set global variable in functions.php
- Passing variables to templates (alternatives to globalizing variables)
- How to get a page url by a page id?
- the_content and wp_link_pages
- Retrieve the template directory URI via global or get_template_directory_uri() every time?
- Check if on last page of paginated post using wp_link_pages
- Detecting Embed URLs Within post_content
- using 1 form shortcode (si or cf7) for all multisite sites [closed]
- How to style current page number (wp_link_pages)?
- Filter the blog title displayed in the header
- How to ignore or disable nextpage tag?
- Filter the blog’s title without using global variables
- How to access global $wp_meta_boxes variable on front-end?
- Multisite Installation: how do I setup global search?
- wp_link_page – wrap current page element
- global $wp_meta_boxes returns NULL
- wp_link_pages output appears twice
- WordPress post/page pagination (page links) to go back to the first section
- Save last login date in global before change it?
- How to check if this is the nth instance of a given shortcode in a post
- Getting two wp_link_pages output
- Passing variables to template parts
- Should I global $wpdb outside of any of my plugin’s functions scope?
- How should I store global information such as a phone number so that it is editable through the CMS?
- Customizing wp_link_pages
- wp_link_pages: display current page number only if has multiple page breaks?
- Add a Class to Current Page WP_LINK_PAGES
- Can I add a ‘show all pages’ link to wp link pages?
- JavaScript, best way to use data from the loop
- Append a to every post to force additional page link (and static content)
- store custom WP table names in a global variable
- How to insert text between the page numbers? [closed]
- When paginating a Page with the tag, how can the 2nd and subsequent page styles be customised?
- WP 4.4.1 allow empty comments via add_action ‘pre_comment_on_post’
- Multisite Global Custom Posts
- Pass variables from one widget to another widget
- Adding a section to admin menu for global settings
- Display only the current page number and another numbered page in pagination
- WordPress Multisite – global categories
- Using query_posts inside single.php loop
- How does the $post_type global variable work?
- How to fix a “globals” issue to avoid a rejected theme?
- after_setup_theme, Global Variable and Theme Customizer
- Global functions on WPMU
- How/where is the global variable $wp_registered_widgets filled?
- Add classname comment template from functions.php
- Cannot update custom database table row
- What are the disadvantages of using global variable?
- Defining a global array in functions.php?
- Insert pagination links – wp_link_pages() – before filters on posts