WordPress.org

Ready to get started?Download WordPress

Forums

links to tags leading to 404 (7 posts)

  1. bakedbean
    Member
    Posted 3 years ago #

    Hello,

    i'm a web developer based in manchester. i'm currently faced with a problem with a client's wordpress installation. when you click on a tag link to view posts by tag name you get a 404 error. all the posts with tags on them can be viewed perfectly so long as they are not accessed by tag. i've done a bit of research and i believe it may have something to do with permalinks. i've tried changing the permalink settings but it won't work.

    can anyone suggest any cures?

    thanks in advance

  2. curtismchale
    Member
    Posted 3 years ago #

    Can you provide the code that is used to display the tags (in pastie) along with a link to the site.

  3. polle001
    Member
    Posted 3 years ago #

    I have the exact same issue.

    Some tags go to 404 not found and some others show an image, yes a post using the tag as title and a image as the body for the post.

    Any ideas ?

  4. StenCade
    Member
    Posted 3 years ago #

    I'm having this problem too. A lot of people seem to be having it. There must be a solution!!

    All my tags lead to a 404. I've tried updating permalinks, deleting and rebuilding the .htaccess file, switching to default theme. Nothing helps.

  5. curtismchale
    Member
    Posted 3 years ago #

    Have you reset your permalinks? Not just gone to the permalinks page but actually saved it (twice)? Can you verify that the correct rules have been written to .htaccess? Does that solve the problem?

  6. StenCade
    Member
    Posted 3 years ago #

    I tried all the permalink solutions that anyone has suggested. This is what FINALLY fixed it for me:

    I installed the "WCS Custom Permalinks Hotfix." Which fixed *part* of the problem. But my "custom post type" tags still weren't working and also weren't showing up in searches. Eventually I found this bit of code:

    add_filter('pre_get_posts', 'query_post_type');
    function query_post_type($query) {
      if(is_category() || is_tag()) {
        $post_type = get_query_var('post_type');
    	if($post_type)
    	    $post_type = $post_type;
    	else
    	    $post_type = array('post','videos', 'galleries', 'nav_menu_item'); // replace cpt to your custom post type
        $query->set('post_type',$post_type);
    	return $query;
        }
    }

    from this thread. Now everything's working great!

  7. StenCade
    Member
    Posted 3 years ago #

    Sorry, 'videos' and 'galleries' are MY custom post types there, and there's sometimes an error with nav menus if you don't include 'nav_menu_item'. Replace with any/all of your own custom post types (you can just keep listing them ad infinitum).

Topic Closed

This topic has been closed to new replies.

About this Topic