[wp-testers] custom post type permalinks

Frank Bueltge frank at bueltge.de
Mon May 17 14:20:23 UTC 2010


I have also this problem. It works fine without active permalinks, but not
with active permalinks.

simple test-source:
function post_type_movies() {
    register_post_type(
        'movies',
        array(
            'label' => __('Movies'),
            'public' => true,
            'show_ui' => true,
            'rewrite' => array('slug' => 'movies'), // Permalink
            'query_var' => 'movies' // for WP_Query Schema
        )
    );
    register_taxonomy( 'actor', 'movies', array( 'hierarchical' => true,
'label' => __('Actor') ) );
    register_taxonomy( 'production', 'movies',
        array(
            'hierarchical' => false,
            'label' => __('Production'),
            'query_var' => 'production',
            'rewrite' => array('slug' => 'production' )
        )
    );
}
add_action('init', 'post_type_movies');

Works fine without Permalinks.
Thanks for reply


On Mon, May 17, 2010 at 3:20 PM, Greg M Boone <boone.greg at gmail.com> wrote:

> Greetings,
> I've been reading almost everything I can find on creating custom post
> types, and wondering how to configure a custom post type so that it will
> match the same permalink structure specified in the wordpress settings. In
> the functions.php for
> 'rewrite' => true, generates: /post_type/post-title structure
> 'rewrite' => false, generates: /?podcast=post-title
> using array ('slug'...) would just generate a custom slug before the post
> title, and array ('with_front') doesn't seem to do anything since I don't
> have a prefixed structure.
>
> My custom structure specified is /%year%/%postname%/ does anyone know how
> to get a custom post type to follow this rule?
> --
> Greg
>
> _______________________________________________
> wp-testers mailing list
> wp-testers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-testers
>


More information about the wp-testers mailing list