WordPress.org

Ready to get started?Download WordPress

Forums

Page Links become "404 File not Found" when Categories are Excluded from Home (7 posts)

  1. discojing
    Member
    Posted 2 years ago #

    Hi,

    I moved my blog from discojing.com and hapatite.com. I only want to show new posts from hapatite.com on the home page while keeping all the old content for archives, indexes, and search.

    When I exclude the category I applied to migrated posts, discojing.com, cat id 88, it makes the pages ~4 instead of 50+, which is good. But then when I click on any page other than 2, it's "File not Found".

    This is when I exclude it in functions.php with

    function exclude_category($query) {
    if ($query->is_home()) {
    $query->set('cat', '-88');
    }
    return $query;
    }
    add_filter('pre_get_posts', 'exclude_category');

    Or when I use Simple Exclude plugin. Is there any way to do a if_category, is_home, don't show argument? I've used if_category to add things, but not hide content.

    I heard this might be an issue with published posts and expected post numbers not matching up.

  2. Krishna
    Volunteer Moderator
    Posted 2 years ago #

    I think the last line filters out all categories because of which you get the 404 errors.

  3. discojing
    Member
    Posted 2 years ago #

    The filtering works. There are 55 pages of posts and it truncates it down to 4 pages. But, when I click on the "Next" page links (aka /page/4 or /page/3), it says "404 not found".

    :(

  4. Please post at the http://studiopress.com forums for this. :)

  5. Paul Menard
    Member
    Posted 1 year ago #

    discojing, I'm not sure I have any advice. I do know my plugin, Simply-Exclude should properly handle the pagination. The plugin does basically what you are doing with the 'pre_get_posts' filter in your functions file. It excludes the category from the query.

    Sounds like your move might be something of the culprit.

  6. discojing
    Member
    Posted 1 year ago #

    I get this issue no matter what theme I use, not just the SP theme

  7. discojing
    Member
    Posted 1 year ago #

    I saw mentioned somewhere that it's an issue with

    published posts and expected post numbers not matching

Topic Closed

This topic has been closed to new replies.

About this Topic