Custom Post Type only working when Logged in
-
You would not believe how long it took me to figure out the problem:
I have a custom post type for events “temds10”, when I’m logged into wordpress, you can see the single temds10 posts via it’s url slug
?event=title_of_event
, — but, if I’m not logged (like my audience won’t be) I’m hit with a 404 error. simply signing back in removes the 404 error, and shows the event.I’m having an impossible time finding out why this is. My register_post_type() is set up normal, but two things I noticed when troubleshooting:
– if I set query_var to anything other than “event” every single thing on the site will 404.. as if wordpress is reliant upon it..
– if I change “temds10” to anything else and add a new post, it works perfectly fine, and I can see single posts logged in or out.. but I’ve coded way to much to change that as a perm solution.that, to me, makes me think that something has gotten corrupt… but I haven’t a clue what.. I searched the databases for anything “temds10” but nothing was written..
$args_array = array( 'label' => __('Events'), 'singular_label' => __('Events'), 'menu_position' => 5, 'public' => true, 'show_ui' => true, // UI in admin panel '_builtin' => false, // It's a custom post type, not built in '_edit_link' => 'post.php?post=%d', 'capability_type' => 'post', 'hierarchical' => false, 'rewrite' => array("slug" => "event"), // Permalinks 'query_var' => 'event', // This goes to the WP_Query schema 'supports' => array('title', 'excerpt', 'thumbnail', 'editor') ); register_post_type('temds10', $args_array);
Does anyone have the vaguest idea what’s happening here, and the route I should take to resolve it?
- The topic ‘Custom Post Type only working when Logged in’ is closed to new replies.