404 page when accessing CPT-onomy post
-
Hi All,
I’ve been trying to get this to work but havent made any success.
The issue is as follows:
I maded a CPT in the backend ‘showcase’ and added posts to the CPT. When i tried to view the post initially i got a 404 page.
So I added a rewrite rule:function add_showcase_rules() { global $wp_rewrite; add_rewrite_rule( "showcase/(.+)/?$", "index.php?post_type=showcase&page=$matches[1]", "top"); } add_action( 'init', 'add_showcase_rules' );and set the permalink to ‘http://s2.noblestreet.eu/%postname%/’
and added a template include function:function tax_page_template( $template ) { global $post_type; if ( $post_type == 'showcase' || $post_type == 'work' ) { if ( $custom_template = locate_template( "single-$post_type.php" ) ) return $custom_template; } return $template; }Now when i go to this page:
http://s2.noblestreet.eu/?showcase=decoder-specs
I see the proper page, but i dont have proper URL handlingWith proper URL handling, i see ALL the posts related post_type ‘showcase’ >
http://s2.noblestreet.eu/showcase/decoder-specs/The question:
How can i get AND proper URL handling AND only the relevant post?Thanks in advance : )
The topic ‘404 page when accessing CPT-onomy post’ is closed to new replies.