Make WordPress Core

Changeset 51982 for trunk


Ignore:
Timestamp:
11/02/2021 06:28:23 PM (3 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.
Fixes #54129.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r51485 r51982  
    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.