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-admin/includes/user.php

    r62096 r62632  
    135135                $user->rich_editing         = isset( $_POST['rich_editing'] ) && 'false' === $_POST['rich_editing'] ? 'false' : 'true';
    136136                $user->syntax_highlighting  = isset( $_POST['syntax_highlighting'] ) && 'false' === $_POST['syntax_highlighting'] ? 'false' : 'true';
     137                $user->infinite_scrolling   = isset( $_POST['infinite_scrolling'] ) && 'false' === $_POST['infinite_scrolling'] ? 'false' : 'true';
    137138                $user->admin_color          = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'modern';
    138139                $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false';
Note: See TracChangeset for help on using the changeset viewer.