post_mime_types Filter not Working in List Mode

The problem lies in the attachment-filter= URL parameter. The slash between application/pdf (or else) is being escaped twice. When you replace the %252F with a slash or %2F the filter will work.

The first escaping (/ becomes %2F) happens when WP is building the selectbox containing the mime types. The second one (%2F becomes %252F) is performed by the browser.

The easiest Solution would be to manually urldecode the URL param somewhere in PHP:

if ( isset( $_GET['attachment-filter'] ) )
    $_GET['attachment-filter'] = urldecode($_GET['attachment-filter']);

Update: There is a WP core ticket on that issue: https://core.trac.wordpress.org/ticket/30123

Once this gets fixed, the answer above will be obsolete.

Leave a Comment