WordPress.org

Ready to get started?Download WordPress

Forums

Custom Post Type admin issues (1 post)

  1. chadmohr
    Member
    Posted 2 years ago #

    Hi there,

    I created a custom post type called Publications that is set to share categories and tags with regular posts. Now if I sort posts by categories in the WP admin panel from either the post or publication list, both post types appear in the results. And what's worse is that if I try to sort again by category I get a screen that says "Invalid Post Type".

    Is there something wrong with the way I have registered the post type? Code is here:

    add_action( 'init', 'sws_register_post_type' );
    function sws_register_post_type(){
        register_post_type('publication', array(
                'labels' => array(
                    'name' => __( 'Publications' ),
                    'singular_name' => __( 'Publication' ),
                    'add_new_item' => __( 'Add New Publication' ),
                    'edit' => __( 'Edit' ),
                    'edit_item' => __( 'Edit Publication' ),
                    'new_item' => __( 'New Publication' ),
                    'view' => __( 'View Publication' ),
                    'view_item' => __( 'View Publication' ),
                    'search_items' => __( 'Search Publications' ),
                    'not_found' => __( 'No publications found' ),
                    'not_found_in_trash' => __( 'No publications found in trash' ),
                ),
                '_builtin' => false,
                'public' => true,
                'show_ui' => true,
                'publicly_queryable' => true,
                'exclude_from_search' => false,
                'hierarchical' => false,
                'taxonomies' => array( 'category', 'post_tag' ),
                'query_var' => true,
                'menu_position' => 5,
                'supports' => array( 'title', 'editor', 'thumbnail', 'author', 'excerpt', 'custom-fields', 'comments', 'revisions' ),
                'has_archive' => true,
                'rewrite' => array( 'slug' => 'publication', 'with_front' => false ),
                'can_export' => true
            ));
    }'

Topic Closed

This topic has been closed to new replies.

About this Topic