post_mime_types filter

Filters the default list of post mime types.

apply_filters( 'post_mime_types', array $post_mime_types )


This is filter hook , which is used for filter the default list of post mime types.

Its used by get_post_mime_types() hook to get default post mine types.


  • $post_mime_types : (array) Default list of post mime types.

Live Example

To run the hook, copy the example below.

$post_mime_types = apply_filters( 'post_mime_types', $post_mime_types ); 
if ( !empty( $post_mime_types ) ) { 
   // everything has led up to this point... 

The following example is for adding a hook callback.

// define the post_mime_types callback 
function filter_post_mime_types( $post_mime_types ) { 
    // make filter magic happen here... 
    return $post_mime_types; 
// add the filter 
add_filter( 'post_mime_types', 'filter_post_mime_types', 10, 1 ); 

To remove a hook callback, use the example below.

// remove the filter 
remove_filter( 'post_mime_types', 'filter_post_mime_types', 10, 1 ); 



 Subscribe to our weekly newsletter below and never miss the latest updates in WordPress