Can /%year%/%monthnum%/%day%/ structure tags be added to custom post type permalinks?

Yes, you should be able to use date based URLs by using the permalink_epmask parameter with your register_post_type call..

add_action('init', 'wpse14370_custom_init');
function wpse14370_custom_init() {
    $args = array(
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true, 
        'show_in_menu' => true, 
        'query_var' => true,
        'rewrite' => true,
        'capability_type' => 'post',
        'has_archive' => true, 
        'hierarchical' => false,
        'menu_position' => null,
        'permalink_epmask' => EP_DATE,
        'supports' => array('title','editor','author','thumbnail','excerpt','comments')
  ); 
  register_post_type('book',$args);
}

Not sure exactly how custom endpoints work, but it’s supported according to the codex page.
http://codex.wordpress.org/Function_Reference/register_post_type

And because it’s not documented, here’s all the possible endpoint values(though i don’t know specifically which are supported with custom post types)..

EP_NONE
EP_PERMALINK
EP_ATTACHMENT
EP_DATE
EP_YEAR
EP_MONTH
EP_DAY
EP_ROOT
EP_COMMENTS
EP_SEARCH
EP_CATEGORIES
EP_TAGS
EP_AUTHORS
EP_PAGES
EP_ALL

If that doesn’t work correctly, maybe just setting with_front to true will be enough if you’re already using date based permalinks.

Leave a Comment