I'm working on a website that has Woocommerce installed (also a CPT if I'm right, but that one works fine). This website has a custom post type for jobs, this cpt has posts that are linked to in the website via their permalink.
The post type works fine in the admin panel but that's as far as it goes. When I click on the "view job opportunity" button in the wordpress admin panel or in the front-end via the permalink it throws an unexpected 404 error.
I did some research on Google and I tried flushing the permalinks via the permalinks options in the admin panel and the flush_rewrite_rules()
function. I also double-checked the way I register the post-type and even tried to disable any rewriting. Another thing I tried was adding a completely new post type but that one also threw a 404 error, however I must say that I just duplicated the code and changed the values. Last but not least: I also disabled almost all plugins in order to see if this was causing the issue.
The post type is registered as follows:
function werkenbij_posttype() { $labels = array( 'name' => 'Werken bij ABC', 'singular_name' => 'Vacature', 'add_new' => 'Vacature toevoegen', 'add_new_item' => 'Vacature toevoegen', 'edit_item' => 'Vacature bewerken', 'new_item' => 'Nieuwe vacature', 'all_items' => 'Alle vacatures', 'view_item' => 'Bekijk vacatures', 'search_items' => 'Zoek vacatures', 'not_found' => 'Geen vacatures gevonden', 'not_found_in_trash' => 'Geen vacatures in de prullenbak gevonden', 'parent_item_colon' => '', 'menu_name' => 'Werken bij ABC' ); $args = array( 'labels' => $labels, 'menu_icon' => get_stylesheet_directory_uri().'/images/werkenbij.png', 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'capability_type' => 'post', 'menu_position' => 5, 'rewrite' => true, 'query_var' => true, 'has_archive' => 'werken-bij', //'_builtin' => true, 'supports' => array( 'title', 'editor', 'thumbnail' ) ); register_post_type( 'werkenbij', $args ); } add_action( 'init', 'werkenbij_posttype' );
Thanks in advance!