[wp-trac] [WordPress Trac] #63668: Media / REST API: Support specifying multiple media types or mime types when listing media
WordPress Trac
noreply at wordpress.org
Mon Jul 7 14:00:15 UTC 2025
#63668: Media / REST API: Support specifying multiple media types or mime types
when listing media
-------------------------------------------------+-------------------------
Reporter: talldanwp | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: REST API | Version: 4.7
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests changes- | Focuses: rest-api
requested |
-------------------------------------------------+-------------------------
Changes (by nikunj8866):
* keywords: has-patch needs-unit-tests => has-patch needs-unit-tests
changes-requested
Comment:
== Test Report
Patch tested:
https://core.trac.wordpress.org/attachment/ticket/63668/63668.patch
=== Steps to Test
1. Start a local `wordpress-devlop` instance with the patch applied.
2. Run REST API endpoint [http://localhost:8889/wp-
json/wp/v2/media?media_type=video,image] in the browser with multiple
media_type.
3. Run REST API endpoint [http://localhost:8889/wp-
json/wp/v2/media?mime_type=image/png,image/jpeg] in browser with multiple
mime_type.
=== Expected Results
When running the test(s):
- ✅ The API returns media items filtered by the `media_type` or
`mime_type` query with multiple comma-separated values.
=== Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.29.0
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 138.0.0.0
- OS: Windows 10/11
- Theme: Twenty Twenty-Five 1.2
- MU Plugins: None activated
- Plugins:
* Amazon S3 Email Testing 1.0.0
* Hello Dolly 1.7.2
* Test Reports 1.2.0
* WP Mail Logging 1.14.0
=== Actual Results
- ✅ The endpoint successfully returns media items of type image and video
as expected (https://prnt.sc/A2wJUOaDaLSu).
- ✅ The endpoint successfully returns media items of mime_type image/png
and image/jpeg as expected (https://prnt.sc/EjPPtoQW4EHK).
=== Additional Notes
🐞 **Bug Identified**: When running the endpoint `http://localhost:8889
/wp-json/wp/v2/media?mime_type=video/mp4,` the API returns all media items
instead of filtering to just video/mp4
items(https://prnt.sc/uPL2rMgESFUx).
This appears to be an existing issue in the REST API's handling of the
`mime_type` query parameter. It may not be related directly to the current
patch but could potentially be addressed or handled as part of the same
ticket for completeness.
=== Conclusion
✅ The current patch works well for `media_type` filtering.
⚠️ There's an outstanding bug with `mime_type` filtering that could be
worth addressing in the same context.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63668#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list