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!

  • your code works fine in a core-bundled theme with no plugins active, so it would seem to be your theme or a plugin causing the issue.
    – Milo
    Commented Jan 20, 2015 at 20:49
  • Do you have any advice on where to start debugging?
    – Davey
    Commented Jan 20, 2015 at 21:06
  • Looks like the WPML plugins were causing this problem, I'll try to get the latest versions of these (my client has to download them first) and get back at this. Thanks in advance :)
    – Davey
    Commented Jan 20, 2015 at 21:26

1 Answer 1


In Admin Panel go to Settings -> Permalinks -> at the lower left click on save changes to refresh all permalinks including your custom post type.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.