From 3ab8d52d78cb9f3b8a8eb27ed22971b00509119e Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 2 Nov 2021 18:30:02 +0000 Subject: [PATCH] Media: Use `WP_Query::get()` method to retrieve the `posts_per_page` value in `wp_ajax_query_attachments()`. This avoids a PHP notice and ensures that a default value is always provided if none is set by the user. Follow-up to [51145], [51485]. Props davidwebca, mukesh27. Fixes #54129. Built from https://develop.svn.wordpress.org/trunk@51982 git-svn-id: http://core.svn.wordpress.org/trunk@51571 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/ajax-actions.php | 2 +- wp-includes/version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index c05345e6e2..1ba480f2f1 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -3003,7 +3003,7 @@ function wp_ajax_query_attachments() { $total_posts = $count_query->found_posts; } - $posts_per_page = (int) $attachments_query->query['posts_per_page']; + $posts_per_page = (int) $attachments_query->get( 'posts_per_page' ); $max_pages = $posts_per_page ? ceil( $total_posts / $posts_per_page ) : 0; diff --git a/wp-includes/version.php b/wp-includes/version.php index 17e22d7553..1b39ea4130 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-51980'; +$wp_version = '5.9-alpha-51982'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.