[wp-trac] [WordPress Trac] #64948: Media Modal: Can no longer set attachment filters
WordPress Trac
noreply at wordpress.org
Tue Apr 28 06:43:49 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 darshitrajyaguru97):
== 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: MySQL
* Browser: Chrome
* OS: Windows
* Theme: Twenty Twenty-Five
* Plugins:
1. Code Snippets 3.9.5 **
2. Test Reports 1.2.1
* MU Plugins: None
=== Steps to Reproduce (Before Patch) ===
1. Add the following snippet to `functions.php` or via Code Snippets:
{{{
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 );
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. Open any post/page editor or Media Library
3. Click "Add Media"
4. Check the browser console
=== Actual Result (Before Patch) ===
* `toolbar.get('filters')` returns an object
* `filters.filters` is **undefined**
* Console output:
{{{
FAIL: filters.filters is undefined
}}}
=== Steps After Applying Patch ===
1. Apply the patch from PR #11415
2. Repeat the steps above
=== Result (After Patch) ===
* `toolbar.get('filters')` is accessible
* `filters.filters` is properly defined
* Console output:
{{{
PASS: filters.filters is accessible
}}}
=== Expected Result ===
Plugins relying on `toolbar.get('filters')` should be able to access
`filters.filters` without encountering `undefined`, ensuring backward
compatibility for media library customizations.
=== Conclusion ===
* ✅ Patch successfully resolves the issue
* ✅ Restores expected behavior for plugin integrations
* ✅ No regressions observed during testing
--
Ticket URL: <https://core.trac.wordpress.org/ticket/64948#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list