From d7518d1927eec720f00626adcc8c1e06f1a7dd25 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 2 Nov 2021 18:28:23 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@51982 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/ajax-actions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index c05345e6e2..1ba480f2f1 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/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;