Preview custom post type posts
-
I’m having difficulty previewing draft posts from within custom post types. If I click the ‘preview’ button it just sends me to the front page of the site.
If I create a custom post type with the custom post type ui plugin (instead of defining it manually in the functions.php file as I’m doing now) then I can preview them so I’m obviously missing something in the register_post_type declaration – i just can’t figure out what.
My code looks like this:
register_post_type( 'press_releases', array( 'labels' => array( 'name' => __( 'Press Releases' ), 'singular_name' => __( 'Press Release' ), 'add_new_item' => __( 'Add New Press Release' ) ), 'menu_position' => 5, 'public' => true, 'rewrite' => array('slug' => 'press-releases', 'with_front' => true), 'supports' => array('title', 'editor', 'excerpt', 'thumbnail' ), 'capabilities' => array( 'edit_post' => 'edit_press_release', 'edit_posts' => 'edit_press_releases', 'edit_others_posts' => 'edit_others_press_releases', 'publish_posts' => 'publish_press_releases', 'read_post' => 'read_press_release', 'read_private_posts' => 'read_private_press_releases', 'delete_post' => 'delete_press_release', ) ) );
The obvious get-out clause for this would be to define the the post types through the plugin but:
- I have around 10 post types already defined and it would be a total pain to re-create them.
- I need to assign separate user capabilities to each post type, something which the plugin doesn’t do.
- I’d really like to know for future reference.
Thanks for your help
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Preview custom post type posts’ is closed to new replies.