Support

Account

Home Forums Backend Issues (wp-admin) Allow Archives URLs Custom Post Types Reply To: Allow Archives URLs Custom Post Types

  • This is my CPT registration code:

    add_action( 'init', 'cptui_register_my_cpts_gallery' );
    function cptui_register_my_cpts_gallery() {
    	$labels = array(
    		"name" => __( 'Gallery', '' ),
    		"singular_name" => __( 'Gallery', '' ),
    		);
    
    	$args = array(
    		"label" => __( 'Gallery', '' ),
    		"labels" => $labels,
    		"description" => "",
    		"public" => true,
    		"publicly_queryable" => true,
    		"show_ui" => true,
    		"show_in_rest" => true,
    		"rest_base" => "",
    		"has_archive" => true,
    		"show_in_menu" => true,
    				"exclude_from_search" => false,
    		"capability_type" => "post",
    		"map_meta_cap" => true,
    		"hierarchical" => false,
    		"rewrite" => array( "slug" => "gallery", "with_front" => true ),
    		"query_var" => true,
    		"menu_position" => 5,
    		"supports" => array( "title", "thumbnail" ),		
    		"taxonomies" => array( "category", "post_tag" ),
    			);
    	register_post_type( "gallery", $args );
    
    }