• Resolved socialreza

    (@socialreza)


    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,
    		),
    	) );
    } );
    
    • This topic was modified 1 year, 10 months ago by socialreza.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter socialreza

    (@socialreza)

    I found the problem after a lot of research, I don’t know if it’s a Advanced Custom Fields plugin bug or not, After I transferred the post types and taxonomy in the Custom Post Type UI plugin to the Advanced Custom Fields plugin using the Advanced Custom Fields plugin tool, I deleted the Custom Post Type UI plugin, Error taxonomy page could not be found, There were several scenarios below :

    1 – When I was editing the post type and deleting the taxonomy field from the beginning and selecting and saving the same from the list -> The page was not found. It was not viewed anymore.
    2 – When I edited the taxonomy and removed the post type from the list and selected it again from the list -> Page not found came back.
    3 – When I was saving WordPress Options Permalink -> Page not found came back.

    Plugin Support ACF Support

    (@acfsupport)

    Hi there!

    ACF Support Team here. This forum is generally used by ACF users to help each other out.

    However, we would love to continue investigating and troubleshooting this issue, please can you create a ticket using our ?support form and we can look into it further.

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.