Cannot view Custom Post Type no matter what I try

Question

This is my code to register the post type:

// Register new post type, User Conversations: b2bking_conversation
        add_action( 'init', array($this, 'b2bking_register_post_type_conversation'), 0 );
function b2bking_register_post_type_conversation() {
        // Build labels and arguments
        $labels = array(
            'name'                  => __( 'Conversations', 'b2bking' ),
            'singular_name'         => __( 'Conversation', 'b2bking' ),
            'all_items'             => __( 'Conversations', 'b2bking' ),
            'menu_name'             => _x( 'Conversations', 'Admin menu name', 'b2bking' ),
            'add_new'               => __( 'Start Conversation', 'b2bking' ),
            'add_new_item'          => __( 'Start new conversation', 'b2bking' ),
            'edit'                  => __( 'Edit', 'b2bking' ),
            'edit_item'             => __( 'Edit conversation', 'b2bking' ),
            'new_item'              => __( 'New conversation', 'b2bking' ),
            'view_item'             => __( 'View conversation', 'b2bking' ),
            'view_items'            => __( 'View conversations', 'b2bking' ),
            'search_items'          => __( 'Search conversations', 'b2bking' ),
            'not_found'             => __( 'No conversations found', 'b2bking' ),
            'not_found_in_trash'    => __( 'No conversations found in trash', 'b2bking' ),
            'parent'                => __( 'Parent conversation', 'b2bking' ),
            'featured_image'        => __( 'Conversation image', 'b2bking' ),
            'set_featured_image'    => __( 'Set conversation image', 'b2bking' ),
            'remove_featured_image' => __( 'Remove conversation image', 'b2bking' ),
            'use_featured_image'    => __( 'Use as conversation image', 'b2bking' ),
            'insert_into_item'      => __( 'Insert into conversation', 'b2bking' ),
            'uploaded_to_this_item' => __( 'Uploaded to this conversation', 'b2bking' ),
            'filter_items_list'     => __( 'Filter conversations', 'b2bking' ),
            'items_list_navigation' => __( 'Conversations navigation', 'b2bking' ),
            'items_list'            => __( 'Conversations list', 'b2bking' )
        );
        $args = array(
            'label'                 => __( 'Conversation', 'b2bking' ),
            'description'           => __( 'This is where you can create new conversations', 'b2bking' ),
            'labels'                => $labels,
            'supports'              => array('title','editor','author', 'comments','thumbnail'),
            'hierarchical'          => false,
            'public'                => true,
            'publicly_queryable'    => true,
            'show_ui'               => true,
            'show_in_menu'          => 'b2bking',
            'menu_position'         => 100,
            'show_in_admin_bar'     => true,
            'can_export'            => true,
            'has_archive'           => true,
            'exclude_from_search'   =>  false,
            'capability_type'       => 'post',
            'rewrite' =>            array("slug" => "conversations"),
        );


    // Actually register the post type
    register_post_type( 'b2bking_conversation', $args );
    }

No matter what I do, I can’t actually view these posts. The link either goes to 404 or some page where only the default Hello World post can be seen, or redirects to the front page.

I ALREADY saved permalinks, tried flush_rewrite_rules(), tried multiple domains…

0
, , , , Stefan S 3 years 2020-03-29T12:51:27-05:00 0 Answers 111 views 0

Leave an answer

Browse
Browse