Not found error after transfer from Custom Post Type UI plugin
-
Everything was fine before transferring from Custom Post Type UI plugin, The structure is as follows :
portfolio = post type
portfolio/category = Taxonomies
https://localhost/portfolio/category/uncategorized/
After transfer It encounters a not found error : https://localhost/portfolio/category/uncategorized/I took these codes from Custom Post Type UI plugin tools
function cptui_register_my_cpts() { /** * Post Type: portfolio. */ $labels = [ "name" => esc_html__( "portfolio", "custom-post-type-ui" ), "singular_name" => esc_html__( "portfolio", "custom-post-type-ui" ), ]; $args = [ "label" => esc_html__( "portfolio", "custom-post-type-ui" ), "labels" => $labels, "description" => "", "public" => true, "publicly_queryable" => true, "show_ui" => true, "show_in_rest" => true, "rest_base" => "", "rest_controller_class" => "WP_REST_Posts_Controller", "rest_namespace" => "wp/v2", "has_archive" => true, "show_in_menu" => true, "show_in_nav_menus" => true, "delete_with_user" => false, "exclude_from_search" => false, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => false, "can_export" => false, "rewrite" => [ "slug" => "portfolio", "with_front" => false ], "query_var" => true, "supports" => [ "title", "editor", "thumbnail", "excerpt", "custom-fields", "revisions" ], "taxonomies" => [ "portfolio-category" ], "show_in_graphql" => false, ]; register_post_type( "portfolio", $args ); /** * Post Type: services. */ $labels = [ "name" => esc_html__( "services", "custom-post-type-ui" ), "singular_name" => esc_html__( "services", "custom-post-type-ui" ), ]; $args = [ "label" => esc_html__( "services", "custom-post-type-ui" ), "labels" => $labels, "description" => "", "public" => true, "publicly_queryable" => true, "show_ui" => true, "show_in_rest" => true, "rest_base" => "", "rest_controller_class" => "WP_REST_Posts_Controller", "rest_namespace" => "wp/v2", "has_archive" => true, "show_in_menu" => true, "show_in_nav_menus" => true, "delete_with_user" => false, "exclude_from_search" => false, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => false, "can_export" => false, "rewrite" => [ "slug" => "services", "with_front" => false ], "query_var" => true, "supports" => [ "title", "editor", "thumbnail", "excerpt", "revisions" ], "show_in_graphql" => false, ]; register_post_type( "services", $args ); } add_action( 'init', 'cptui_register_my_cpts' ); function cptui_register_my_cpts_portfolio() { /** * Post Type: portfolio. */ $labels = [ "name" => esc_html__( "portfolio", "custom-post-type-ui" ), "singular_name" => esc_html__( "portfolio", "custom-post-type-ui" ), ]; $args = [ "label" => esc_html__( "portfolio", "custom-post-type-ui" ), "labels" => $labels, "description" => "", "public" => true, "publicly_queryable" => true, "show_ui" => true, "show_in_rest" => true, "rest_base" => "", "rest_controller_class" => "WP_REST_Posts_Controller", "rest_namespace" => "wp/v2", "has_archive" => true, "show_in_menu" => true, "show_in_nav_menus" => true, "delete_with_user" => false, "exclude_from_search" => false, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => false, "can_export" => false, "rewrite" => [ "slug" => "portfolio", "with_front" => false ], "query_var" => true, "supports" => [ "title", "editor", "thumbnail", "excerpt", "custom-fields", "revisions" ], "taxonomies" => [ "portfolio-category" ], "show_in_graphql" => false, ]; register_post_type( "portfolio", $args ); } add_action( 'init', 'cptui_register_my_cpts_portfolio' ); function cptui_register_my_cpts_services() { /** * Post Type: services. */ $labels = [ "name" => esc_html__( "services", "custom-post-type-ui" ), "singular_name" => esc_html__( "services", "custom-post-type-ui" ), ]; $args = [ "label" => esc_html__( "services", "custom-post-type-ui" ), "labels" => $labels, "description" => "", "public" => true, "publicly_queryable" => true, "show_ui" => true, "show_in_rest" => true, "rest_base" => "", "rest_controller_class" => "WP_REST_Posts_Controller", "rest_namespace" => "wp/v2", "has_archive" => true, "show_in_menu" => true, "show_in_nav_menus" => true, "delete_with_user" => false, "exclude_from_search" => false, "capability_type" => "post", "map_meta_cap" => true, "hierarchical" => false, "can_export" => false, "rewrite" => [ "slug" => "services", "with_front" => false ], "query_var" => true, "supports" => [ "title", "editor", "thumbnail", "excerpt", "revisions" ], "show_in_graphql" => false, ]; register_post_type( "services", $args ); } add_action( 'init', 'cptui_register_my_cpts_services' ); function cptui_register_my_taxes() { /** * Taxonomy: category. */ $labels = [ "name" => esc_html__( "category", "custom-post-type-ui" ), "singular_name" => esc_html__( "category", "custom-post-type-ui" ), ]; $args = [ "label" => esc_html__( "category", "custom-post-type-ui" ), "labels" => $labels, "public" => true, "publicly_queryable" => true, "hierarchical" => true, "show_ui" => true, "show_in_menu" => true, "show_in_nav_menus" => true, "query_var" => true, "rewrite" => [ 'slug' => 'portfolio/category', 'with_front' => false, 'hierarchical' => true, ], "show_admin_column" => false, "show_in_rest" => true, "show_tagcloud" => false, "rest_base" => "portfolio-category", "rest_controller_class" => "WP_REST_Terms_Controller", "rest_namespace" => "wp/v2", "show_in_quick_edit" => false, "sort" => false, "show_in_graphql" => false, ]; register_taxonomy( "portfolio-category", [ "portfolio" ], $args ); } add_action( 'init', 'cptui_register_my_taxes' ); function cptui_register_my_taxes_portfolio_category() { /** * Taxonomy: category. */ $labels = [ "name" => esc_html__( "category", "custom-post-type-ui" ), "singular_name" => esc_html__( "category", "custom-post-type-ui" ), ]; $args = [ "label" => esc_html__( "category", "custom-post-type-ui" ), "labels" => $labels, "public" => true, "publicly_queryable" => true, "hierarchical" => true, "show_ui" => true, "show_in_menu" => true, "show_in_nav_menus" => true, "query_var" => true, "rewrite" => [ 'slug' => 'portfolio/category', 'with_front' => false, 'hierarchical' => true, ], "show_admin_column" => false, "show_in_rest" => true, "show_tagcloud" => false, "rest_base" => "portfolio-category", "rest_controller_class" => "WP_REST_Terms_Controller", "rest_namespace" => "wp/v2", "show_in_quick_edit" => false, "sort" => false, "show_in_graphql" => false, ]; register_taxonomy( "portfolio-category", [ "portfolio" ], $args ); } add_action( 'init', 'cptui_register_my_taxes_portfolio_category' );
I took these codes from acf plugin tools
add_action( 'init', function() { register_post_type( 'services', array( 'labels' => array( 'name' => 'services', 'singular_name' => 'services', ), 'public' => true, 'show_in_rest' => true, 'supports' => array( 0 => 'title', 1 => 'editor', 2 => 'thumbnail', 3 => 'excerpt', 4 => 'revisions', ), 'has_archive' => true, 'rewrite' => array( 'with_front' => false, 'feeds' => false, ), 'can_export' => false, 'delete_with_user' => false, ) ); register_post_type( 'portfolio', array( 'labels' => array( 'name' => 'portfolio', 'singular_name' => 'portfolio', ), 'public' => true, 'show_in_rest' => true, 'supports' => array( 0 => 'title', 1 => 'editor', 2 => 'thumbnail', 3 => 'excerpt', 4 => 'custom-fields', 5 => 'revisions', ), 'taxonomies' => array( 0 => 'portfolio-category', ), 'has_archive' => true, 'rewrite' => array( 'with_front' => false, 'feeds' => false, ), 'can_export' => false, 'delete_with_user' => false, ) ); } ); add_action( 'init', function() { register_taxonomy( 'portfolio-category', array( 0 => 'portfolio', ), array( 'labels' => array( 'singular_name' => 'category', 'name' => 'category', ), 'public' => true, 'hierarchical' => true, 'show_in_rest' => true, 'show_tagcloud' => false, 'show_in_quick_edit' => false, 'rewrite' => array( 'slug' => 'portfolio/category', 'with_front' => false, 'hierarchical' => true, ), ) ); } );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Not found error after transfer from Custom Post Type UI plugin’ is closed to new replies.