Make WordPress Core


Ignore:
Timestamp:
07/03/2026 03:36:02 PM (3 months ago)
Author:
tyxla
Message:

Media: Enable Media Library infinite scrolling and add an opt-out user option.

Infinite scrolling in the Media Library grid is now enabled by default.

Users can now opt out via a new "Infinite Scrolling" user option on the
profile screen, labeled "Disable infinite scrolling in the Media Library
grid view". The option is only shown to users with the upload_files
capability, since the attachment grid is unreachable without it.

Precedence is resolved as follows: the media_library_infinite_scrolling
filter takes precedence over everything, so a hooked filter always wins.
Absent a filter, the user's opt-out preference applies. Absent both, infinite
scrolling defaults to enabled.

Include unit tests covering persistence of the new user option and the
filter, preference, and default precedence.

Props tyxla, youknowriad, joedolson, sachinrajcp123.
Fixes #65564.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/user-edit.php

    r62262 r62632  
    376376                                                </td>
    377377                                        </tr>
     378
     379                                        <?php if ( user_can( $profile_user, 'upload_files' ) ) : ?>
     380                                        <tr class="user-infinite-scrolling-wrap">
     381                                                <th scope="row"><?php _e( 'Infinite Scrolling' ); ?></th>
     382                                                <td>
     383                                                        <label for="infinite_scrolling"><input name="infinite_scrolling" type="checkbox" id="infinite_scrolling" value="false" <?php checked( 'false', $profile_user->infinite_scrolling ); ?> />
     384                                                                <?php _e( 'Disable infinite scrolling in the Media Library grid view' ); ?>
     385                                                        </label>
     386                                                </td>
     387                                        </tr>
     388                                        <?php endif; ?>
    378389
    379390                                        <?php
Note: See TracChangeset for help on using the changeset viewer.