Im using the CPT UI plugin to create my custom post types. I was wondering what i needed to do in order to see an archive of my custom post type by post format ie..

usually for default posts the url is example.com/type/audio

i have tried example.com/resource/type/audio but it does not work.

I have read some places you can do it, and other places can't. any help would be greatly appreciated



1 Answer 1


There are no rewrite rules generated for post formats specific to post type. If you want pretty URLs for post type specific post formats, you need to add them yourself.

// post_type doesn't seem to work,
// add rules to set custom query var
function resource_post_formats_urls() {
    // pagination
add_action( 'init', 'resource_post_formats_urls' );

// add query var so it's recognized
function resource_query_vars( $qvars ) {
    $qvars[] = 'resource_only';
    return $qvars;
add_filter( 'query_vars', 'resource_query_vars' , 10, 1 );

// check if query var is set and modify post_type for the query
function modify_resource_tax_query( $query ) {
    if( isset( $query->query_vars['resource_only'] ) ){
        $query->set( 'post_type', array('resource') );
add_action( 'pre_get_posts', 'modify_resource_tax_query' );

Note that this will only handle incoming requests for existing formats. You'll need to manually create the links to these pages.

Another way to handle it is to create your own custom format taxonomy and set the rewrite slug to resource/type.

  • HI, i changed the rewrite slug to "resource/type" but i still cant get it to work to show the post format.. Am i missing something?
    – DEM
    Nov 29, 2015 at 19:58
  • changed the rewrite slug of what? that would be the slug of a new custom taxonomy used to duplicate the function of post formats.
    – Milo
    Nov 29, 2015 at 20:02
  • i have a custom taxonomy called resource category ('resource-category' is the slug and it is attached to the CPT called 'resource') under CPT UI plugin i changed the 'custom rewrite slug' value to "resources/type" is that not correct to display post fromat for the CPT? - thanks
    – DEM
    Nov 29, 2015 at 20:06
  • that will display posts with terms from resource-category assigned, did you create terms and assign them to posts?
    – Milo
    Nov 29, 2015 at 20:08
  • yes did both, i just want to display posts that have a specific post fromat from the CPT - it seems that it only works for the default post type in WP
    – DEM
    Nov 29, 2015 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.