Making WordPress.org

Changeset 12967


Ignore:
Timestamp:
11/14/2023 11:12:02 PM (10 months ago)
Author:
coffee2code
Message:

Photo Directory, Posts: Take into account logged-out pagination limit on w.org.

Since the front page limit differs from the archive limits, the Photo Directory does its own max page calculation, which is not compatible with the WPORG_Page_Limiter's own generic calculation.

Fixes #6214.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/photo-directory/inc/posts.php

    r12770 r12967  
    315315     */
    316316    public static function fix_front_page_pagination_count( $posts, $query ) {
    317         if ( $query->is_home() ) {
     317        if ( $query->is_home() && $query->is_main_query() ) {
    318318            $front_page_count  = get_option( 'posts_per_page' );
    319319            $archives_per_page = 30;
     
    323323            if ( $total_posts > 0 ) {
    324324                $count += ceil( $total_posts / $archives_per_page );
     325            }
     326            // Account for logged-out pagination limit on w.org.
     327            if ( defined( '\WPORG_Page_Limiter::MAX_PAGES' ) && ! is_user_logged_in() ) {
     328                $count = min( $count, \WPORG_Page_Limiter::MAX_PAGES );
    325329            }
    326330            $query->max_num_pages = $count;
Note: See TracChangeset for help on using the changeset viewer.