[wp-trac] [WordPress Trac] #64948: Media Modal: Can no longer set attachment filters
WordPress Trac
noreply at wordpress.org
Tue Apr 14 15:45:39 UTC 2026
#64948: Media Modal: Can no longer set attachment filters
-----------------------------+-------------------------
Reporter: Bernhard Reiter | Owner: joedolson
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 7.0
Component: Media | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch | Focuses: javascript
-----------------------------+-------------------------
Comment (by ozgursar):
== Patch Testing Report
Patch Tested: https://github.com/WordPress/wordpress-develop/pull/11415
=== Environment
- WordPress: 7.1-alpha-62161-src
- PHP: 8.2.29
- Server: nginx/1.29.4
- Database: mysqli (Server: 8.4.7 / Client: mysqlnd 8.2.29)
- Browser: Chrome 146.0.0.0
- OS: macOS
- Theme: Twenty Twenty-Five 1.4
- MU Plugins: None activated
- Plugins:
* Code Snippets 3.9.5
* Test Reports 1.2.1
=== Steps taken
1. Add the following PHP snippet to your active theme's `functions.php` or
via Code Snippets plugin to simulate accessing the filters.
{{{
add_action( 'admin_footer', function () {
if ( ! did_action( 'wp_enqueue_media' ) ) {
return;
}
?>
<script>
jQuery( document ).ready( function ( $ ) {
if ( ! wp || ! wp.media || ! wp.media.view || !
wp.media.view.AttachmentsBrowser ) {
return;
}
var OrigBrowser = wp.media.view.AttachmentsBrowser;
wp.media.view.AttachmentsBrowser = OrigBrowser.extend( {
createToolbar: function () {
OrigBrowser.prototype.createToolbar.apply( this, arguments
);
var toolbar = this.toolbar;
var filters = toolbar.get( 'filters' );
console.log( '[Ticket 64948] toolbar.get("filters"):',
filters );
console.log( '[Ticket 64948] filters.filters:', filters &&
filters.filters );
// Simulate what affected plugins do:
if ( filters && typeof filters.filters !== 'undefined' ) {
console.info( '[Ticket 64948] PASS: filters.filters is
accessible.' );
} else {
console.error( '[Ticket 64948] FAIL: filters.filters
is undefined.' );
}
}
} );
} );
</script>
<?php
} );
}}}
2. Navigate to any post/page editor or the Media Library
3. Click ''Add Media'' to open the media modal
4. Observe the browser console
5. Confirm that `filters.filters` is undefined
6. Apply the patch and repeat steps 2-4
7. Observe the browser console again
8. Confirm that `toolbar.get("filters")` and `filters.filters` are
accessible
9. ✅ Patch is solving the problem.
=== Expected result
- Plugins that customize media library filters by accessing
`toolbar.get("filters")` should continue to work correctly, and no errors
related to `filters.filters` being `undefined` should appear in the
browser console.
=== Screenshots/Screencast with results
Before
[[Image(https://core.trac.wordpress.org/raw-
attachment/ticket/64948/before-64948.webp)]]
After
[[Image(https://core.trac.wordpress.org/raw-
attachment/ticket/64948/after-64948.webp)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64948#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list