using globals from wp_link_pages function
I'm following this reference page for wp_link_pages:https://developer.wordpress.org/reference/functions/wp_link_pages/
In it, 4 global variables are declared: $page, $numpages, $multipage, $more. I'm able to access it in my templatexxxx.php by doing this:
global $numpages;
global $page;
echo $numpages;
echo $page;
My question is this: should I be doing this? I have been taught that using/accessing global is bad. But short of coding an entire function (which seems to be a bit overkill), this seems to be the fastest and easiest way to obtain the current page and the total number of pages. Unless there's another function in the core that already does this? :S
Topic wp-link-pages globals Wordpress
Category Web