Docs: Consistently declare the `$wp_query` global in link template functions.
This ensures that the global is explicitly declared and documented in: * `get_next_posts_link()` * `get_posts_nav_link()` * `get_the_posts_navigation()` * `get_the_posts_pagination()` * `get_next_comments_link()` Follow-up to [30065]. Props mt8.biz, sabernhardt. Fixes #43164. Built from https://develop.svn.wordpress.org/trunk@53520 git-svn-id: http://core.svn.wordpress.org/trunk@53109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c70a5c547f
commit
481da1b9f4
|
@ -2765,10 +2765,12 @@ function the_post_navigation( $args = array() ) {
|
|||
* @return string Markup for posts links.
|
||||
*/
|
||||
function get_the_posts_navigation( $args = array() ) {
|
||||
global $wp_query;
|
||||
|
||||
$navigation = '';
|
||||
|
||||
// Don't print empty markup if there's only one page.
|
||||
if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
|
||||
if ( $wp_query->max_num_pages > 1 ) {
|
||||
// Make sure the nav element has an aria-label attribute: fallback to the screen reader text.
|
||||
if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) {
|
||||
$args['aria_label'] = $args['screen_reader_text'];
|
||||
|
@ -2821,6 +2823,8 @@ function the_posts_navigation( $args = array() ) {
|
|||
* @since 5.3.0 Added the `aria_label` parameter.
|
||||
* @since 5.5.0 Added the `class` parameter.
|
||||
*
|
||||
* @global WP_Query $wp_query WordPress Query object.
|
||||
*
|
||||
* @param array $args {
|
||||
* Optional. Default pagination arguments, see paginate_links().
|
||||
*
|
||||
|
@ -2832,10 +2836,12 @@ function the_posts_navigation( $args = array() ) {
|
|||
* @return string Markup for pagination links.
|
||||
*/
|
||||
function get_the_posts_pagination( $args = array() ) {
|
||||
global $wp_query;
|
||||
|
||||
$navigation = '';
|
||||
|
||||
// Don't print empty markup if there's only one page.
|
||||
if ( $GLOBALS['wp_query']->max_num_pages > 1 ) {
|
||||
if ( $wp_query->max_num_pages > 1 ) {
|
||||
// Make sure the nav element has an aria-label attribute: fallback to the screen reader text.
|
||||
if ( ! empty( $args['screen_reader_text'] ) && empty( $args['aria_label'] ) ) {
|
||||
$args['aria_label'] = $args['screen_reader_text'];
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-alpha-53519';
|
||||
$wp_version = '6.1-alpha-53520';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue