This topic contains 5 replies, has 3 voices, and was last updated by  Jason 4 years, 11 months ago.

  • Author
  • #2696


    Hi folks! My client just brought to my attention the fact that an entire section of his site is giving a 404 error and I think Piklist “may” be connected. I’m thinking this because I haven’t changed anything else, but I did update Piklist to the latest version; and I’m using Piklist code in functions.php to declare my CPT.

    The page in question is http://escape2ski.com/adaptive-snow-sports/ , however I’ve removed the link from the site menu while I sort out this trouble.

    Below is the functions.php code that – until now – was successfully generating my CPT. Please let me know if you see anything amiss or if this might be some sort of bug or something… thanks!


    add_filter('piklist_post_types', 'adaptive_post_type');
     function adaptive_post_type($post_types)
      $post_types['adaptive-snow-sports'] = array(
        'labels' => piklist('post_type_labels', 'Adaptive Resource'),
        'title' => __('Enter Custom Title'),
        'public' => true,
        'has_archive' => true,
        'capability_type' => 'post',
    	'menu_position' => 4,
    	'rewrite' => array(
    					'slug' => 'adaptive-snow-sports'
    	'supports' => array(
        'taxonomies' => array(
    return $post_types;
    add_filter( 'template_include', 'include_template_function', 1 );
    function include_template_function( $template_path ) {
        if ( get_post_type() == 'adaptive-snow-sports' ) {
            if ( is_single() ) {
                // checks if the file exists in the theme first,
                // otherwise serve the file from the plugin
                if ( $theme_file = locate_template( array ( 'adaptive-snow-sports.php' ) ) ) {
                    $template_path = $theme_file;
            elseif ( is_archive() ) {
                if ( $theme_file = locate_template( array ( 'archive-adaptive-snow-sports.php' ) ) ) {
                    $template_path = $theme_file; 
        return $template_path;
    add_action( 'init', 'create_my_taxonomies', 0 );
    function create_my_taxonomies() {
                'labels' => array(
                    'name' => 'Country',
                    'add_new_item' => 'Add New Country',
                    'new_item_name' => "New Country"
                'show_ui' => true,
                'show_tagcloud' => false,
                'hierarchical' => true
  • #2697


    OK, you’re going to think I’m crazy – and I might agree with you – but the page has returned to full functionality!

    This, without me touching or changing anything. Mere minutes after I posted my issue here.

    While I’m happy it’s working now (and that – I presume – it wasn’t Piklist’s fault in any way!)… I sure am not reassured that it won’t go away again. For a reason I seemingly can’t ever know. Ugh.

    Well, I’ll assume things are fine, and there certainly is nothing you can troubleshoot, but if you have any thoughts at all, I’d welcome them.

    Thanks again!

    • #2713


      If an issue like that happens and then goes away, it usually means you got bit by a cache imp. I’ve definitely had that happen, and it usually goes down like this:

      1. I break something.
      2. I view it in the browser and it (or the server) decide to cache at that moment
      3. I fix the issue.
      4. I look in the browser. Still looks broken.
      5. I stare, bewildered at my code as to how the same thing I’ve always done is now not working.
      6. I cry out to the heavens and curse out my profession, computer, etc..
      7. The cache decides to clear, everything works, and I’m deeply offended.


  • #2709


    @cosmocanuck– Sometimes when you register a Post Type with WordPress you also need to flush the permalnks. This means going to the SETTINGS > PERMALINKS page in wp-admin. This is a WordPress issue, not Piklist.

  • #2730


    Jason, that was one of the best programming-related laughs (heck, any kind of laugh) I’ve had in some time, thanks! I’m going to paste that up on my wall to help keep me sane when this sort of thing happens again!

    Steve – thanks and I’ll keep that in mind in the future!

    • #2731


      Hahah! I’m just sharing my heart. 😉

The topic ‘Custom Post Type archives and posts giving a 404. Piklist bug?’ is closed to new replies.