Make WordPress Core


Ignore:
Timestamp:
07/03/2026 03:36:02 PM (4 weeks 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-includes/user.php

    r62413 r62632  
    22462246                                'rich_editing',
    22472247                                'syntax_highlighting',
     2248                                'infinite_scrolling',
    22482249                                'comment_shortcuts',
    22492250                                'admin_color',
     
    25092510
    25102511        $meta['syntax_highlighting'] = empty( $userdata['syntax_highlighting'] ) ? 'true' : $userdata['syntax_highlighting'];
     2512
     2513        $meta['infinite_scrolling'] = empty( $userdata['infinite_scrolling'] ) ? 'true' : $userdata['infinite_scrolling'];
    25112514
    25122515        $meta['comment_shortcuts'] = empty( $userdata['comment_shortcuts'] ) || 'false' === $userdata['comment_shortcuts'] ? 'false' : 'true';
     
    30203023 */
    30213024function _get_additional_user_keys( $user ) {
    3022         $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'syntax_highlighting', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'locale' );
     3025        $keys = array( 'first_name', 'last_name', 'nickname', 'description', 'rich_editing', 'syntax_highlighting', 'infinite_scrolling', 'comment_shortcuts', 'admin_color', 'use_ssl', 'show_admin_bar_front', 'locale' );
    30233026        return array_merge( $keys, array_keys( wp_get_user_contact_methods( $user ) ) );
    30243027}
Note: See TracChangeset for help on using the changeset viewer.