I have a category on my website called 'profiles' I am in the process of moving this category to a custom post type called 'profiles'.

My problem is I cannot get the archive page to show for this custom post type. When I go to the url mywebsite.com/profiles it takes me to a single post page for a post in the profiles category.

I have included has_archive = true; in my functions.php

I didn't have a problem creating an archive page for another custom post type I did on the same website so Im really lost as to why this is not working this time.

Any advice would be most appreciated?

add_action( 'init', 'profile_custom_init' );

/* Here's how to create your customized labels */
function profile_custom_init() {
$labels = array(
    'name' => _x( 'Profiles', 'post type general name' ), // Tip: _x('') is used for localization
    'singular_name' => _x( 'Profile', 'post type singular name' ),
    'add_new' => _x( 'Add New', 'Profile' ),
    'add_new_item' => __( 'Add Profile' ),
    'edit_item' => __( 'Edit Profile' ),
    'new_item' => __( 'New Profile' ),
    'view_item' => __( 'View Profile' ),
    'search_items' => __( 'Search Profile' ),
    'not_found' =>  __( 'No Profile found' ),
    'not_found_in_trash' => __( 'No Profile found in Trash' ),
    'parent_item_colon' => ''

// Create an array for the $args
$args = array( 'labels' => $labels, /* NOTICE: the $labels variable is used here... */
    'public' => true,
    'publicly_queryable' => true,
    'has_archive' => true,
    'show_ui' => true,
    'query_var' => true,
    'rewrite' => true,
    'capability_type' => 'post',
    'hierarchical' => false,
    'menu_position' => 10,
    'supports' => array( 'title', 'editor','thumbnail', 'excerpt', 'custom-fields' ),
        'taxonomies' => array('category')

    register_post_type( 'profile', $args ); /* Register it and move on */
  • Try changing profile category slug to something else like profiles-2. Mar 4, 2013 at 10:45
  • Doesnt seem to work. Also if I go to the url mywebsite.com/his for example instead of taking me to a 404 page (I dont have any page or post called just 'His') it takes me to a post beginning with the word 'his'. This seems very strange?
    – stemie
    Mar 4, 2013 at 10:55
  • Have you tried to save your permalink structure again? This causes the rewrite rules to be regenerated. Mar 4, 2013 at 11:03
  • Try re saving permalink structure by clicking on Save Changes button of Permalink Settings. Mar 4, 2013 at 11:04

2 Answers 2

  1. Navigate to Settings -> permalinks
  2. Change the permalink structure to Default
  3. Save settings
  4. Change to custom structure or post name (or any other structure)
  5. Save Settings

This will re-write the htaccess file and then the re-write should work.

If the above solution doesn't work - it should be related to server configuration.


Run: a2enmod rewrite && service apache2 reload


Follow: https://do.co/2LjCF8r

I hope this will save your time.

  • This solved it for me.
    – HippoDuck
    Sep 4, 2019 at 15:12
  • Classic flush_rewrite_rules, always forget about it :) Apr 11, 2022 at 15:10
  • 1-5 worked for me
    – breadwild
    Sep 13, 2022 at 19:33

Re saving the permalink structure seemed to fix the issue. Thanks for the tip Mike and Vinod.

  • 1
    I answered this before Nikhil and thought it would be helpful. I hadn't checked back since he posted the better answer. So it's a bit unfair to accuse me of not giving the credit to the people who posted the answer.
    – stemie
    May 21, 2018 at 16:31
  • my bad, I saw the march after october and thought it was the next year.. your sparse answer combined with that looked like a quick credit grab.. I should have looked more closely (sorting by number of votes doesn't help with quick looks either), gave you the up-vote on both question and answer
    – Kender
    May 22, 2018 at 17:27
  • @Kender - I haven't had any intention to grab credits of someone else answer or copying it. I answered it as per my experience and I have explained the answer in a detailed manner. It may help lots of developers to fix the problem from the CMS side as well as the server.
    – Nikhil
    Mar 15, 2019 at 9:31

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.