I've been battling with this for a while. I have a CPT created with PostTypes (I have used this library many many times in other projects w/o problems):
$volunteer = new PostType( 'volunteer' ); $volunteer->options( array( 'supports' => array( 'title' ), 'capability_type' => 'post', 'publicly_queryable' => true, 'show_in_rest' => false, 'has_archive' => true, 'public' => true, 'show_ui' => true, 'rewrite' => array( 'slug' => 'volunteers', ), ) ); $volunteer->icon( 'dashicons-groups' ); $volunteer->register();
I have opened
Options->Permalinks and saved settings so that permalinks will display as Post name.
I have created a couple of volunteer posts.
In one page I am using a custom query to bring the results. I create a link to the post by using the permalink which renders this URL:
Which is odd because (AFAIK) should be:
When I click the link, I get a 404. When I type in the second permalink, I immediately get sent to the home page, it does not show an error. I have tried to debug this in index.php but by the time the breakpoint hits, it's referring to info on the page.
I have added archive-volunteer.php and single-volunteer.php and they never get invoked no matter what I do.
This has really left me baffled, I don't think I'm making a careless mistake anywhere.
Has anyone experience anything like this before or can recommend any tools that might lead me in the right direction? I already have installed Show Current Template.
Thanks in advance!