Make WordPress Core

Changeset 51983


Ignore:
Timestamp:
11/02/2021 06:32:24 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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, circlecube, desrosj.
Merges [51982] to the 5.8 branch.
Fixes #54129.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-admin/includes/ajax-actions.php

    r51507 r51983  
    30043004        }
    30053005
    3006         $posts_per_page = (int) $attachments_query->query['posts_per_page'];
     3006        $posts_per_page = (int) $attachments_query->get( 'posts_per_page' );
    30073007
    30083008        $max_pages = $posts_per_page ? ceil( $total_posts / $posts_per_page ) : 0;
Note: See TracChangeset for help on using the changeset viewer.