Media Library infinite scrolling now on by default
Background
The grid view of the Media Library (including the Media Modal) has supported infinite scrolling for a long time, where attachments load automatically as you scroll instead of behind a Load more button. That behavior was controlled by the media_library_infinite_scrolling filter, which defaulted to false since WordPress 5.8. As a result, infinite scrolling was effectively off for everyone unless a plugin or theme opted in via the filter.
The Load more button has long been a friction point for users managing large media libraries, and the smoother infinite-scroll experience was hidden behind code that most sites never enabled.
What changed
In WordPress 7.1 (#65564):
- Infinite scrolling is now enabled by default. The
media_library_infinite_scrollingfilter now defaults totrue, so the grid view auto-loads attachments on scroll out of the box. This applies to both the Grid view of the Media Library, and the Media Modal. - Users can opt out individually. A new Infinite Scrolling personal option appears on the profile screen (Users > Profile), with a checkbox labeled “Disable infinite scrolling in the Media Library grid view” (unchecked by default). The option is only shown to users who have the
upload_filescapability, since the attachment grid is unreachable without it.
Precedence
The effective setting is resolved in this order, from highest priority to lowest:
- The
media_library_infinite_scrollingfilter: a hooked filter callback always wins. - The user’s opt-out preference: applies when no filter is hooked.
- The default (
true): applies when neither of the above is set.
In other words: filter > user preference > default.
Developer-facing details
The filter’s default changed
If your plugin or theme relies on the previous behavior (infinite scrolling off unless explicitly enabled), be aware that the default is now true. To force the previous behavior for all users regardless of their preference, you can use the filter, as it takes precedence over everything:
// Force infinite scrolling OFF for all users (restores to the behavior that was default between 5.8 and 7.1).
add_filter( 'media_library_infinite_scrolling', '__return_false' );
// Force infinite scrolling ON for all users, ignoring per-user opt-out.
add_filter( 'media_library_infinite_scrolling', '__return_true' );
Because the filter runs after the per-user preference is read, adding a callback overrides any individual user’s choice.
The new user option
The preference is stored as a user option under the meta key infinite_scrolling, as the string 'true' or 'false', consistent with how existing options such as syntax_highlighting and rich_editing are persisted. It is also wired consistently through the profile form (user-edit.php), the save handler (edit_user()), and persistence in wp_insert_user() and _get_additional_user_keys().
You can read a user’s preference programmatically:
// The user setting is 'false' if the user has disabled infinite scrolling, 'true' (or empty) otherwise.
$infinite_scrolling_disabled = 'false' === get_user_option( 'infinite_scrolling', $user_id );
Note the direction of the stored value: 'false' means the user has disabled infinite scrolling. wp_enqueue_media() reads this option to determine the pre-filter default.
Backwards compatibility
- The
media_library_infinite_scrollingfilter is unchanged in signature; only its default value changed (fromfalsetotrue). Existing callbacks continue to work exactly as before and still take precedence. - Sites that had already opted in via
__return_truesee no change. - Sites that never touched the filter now get infinite scrolling by default; users who prefer the Load more button can opt out from their profile.
Props to @youknowriad, @khokansardar, @wildworks, @davidbaumwald, @joedolson, @sabernhardt for reviewing.
#7-1, #dev-notes, #dev-notes-7-1, #media, #media-library, #media-grid
Fetched July 23, 2026


