• Hello. I’m hoping someone can help me out.

    I read an article about using a custom plugin to create custom post types. So I did. Activated it. It went great. This is what the code looks like.

    add_action( 'init', 'datcustomtype_customtypes_cpt' );    
    
    function datcustomtype_customtypes_cpt() {
    	register_post_type( 'our_team', array(
    	'labels' => array(
    		'name' => 'Our Team',
    		'singular_name' => 'Our Team',
    	),
    
    	'description' => 'Team Member Pages',
    	'public' => true,
    	'menu_position' => 20,
    
    		'capability_type' => 'post',
    		'hierarchical' => true,
    		'has_archive' => true,
    		'rewrite' => array( 'slug' => '/who-we-are/team' ), 
    
    	'supports' => array( 'title', 'editor')
    ));
    
    }

    The rewrite slug works great too http://www.example.com/who-we-are/team/NAME works perfectly.

    But. No matter how many times I flush the permalink rules. I can’t get http://www.example.com/who-we-are/team/ to display anything but a super annoying 404.

    I have created archive-our_team.php and single-our_team.php and the single pages are totally customized and ready to go, but I can’t even see the archive page to try and do anything.

    What am I doing wrong?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I just got stuck on this as well. You want to remove the slash in front of the rewrite slug:

    'rewrite' => array( 'slug' => 'who-we-are/team' )

    Thread Starter UncleFUJ

    (@unclefuj)

    You’ve got to be kidding me. I can’t believe it’s was that easy.

    Thank you sir!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom Post Type and Rewrite Slug Not working for Archive page’ is closed to new replies.