• Resolved Zahak

    (@zahak)


    [Code moderated as per the Forum Rules. Please use the pastebin]

    Of some reason we want to fetch posts from both category and tags, where both equals something. As far as I know this can’t be done with normal custom queries, therefor this special thing.

    It works perfect on first page. Next buttons show up as they should etc. However, when entering https://url/something/page/2/ it goes nuts, and returns true on is_404();
    It doesn’t matter if i try to kill it to debug inside my code.

    I have tried plugins to fix it (removing /page/), but that doesn’t help. Anyone got any ideas?

    If it matters, it is multisite installation.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Zahak

    (@zahak)

    …and link to pastebin: https://pastebin.com/Hz3EahGQ

    Thread Starter Zahak

    (@zahak)

    Okey, never mind I guess.. Just finished a fix by myself, which I actually think is prettier.

    https://pastebin.com/6KqTviVN

    Instead of calling my function inside theme like before, I used add_action to replace parts of wp query.

    The problem was that WordPress only calculated on posts connected to category, and not posts connected to tag. As I wanted both, this didn’t work.

    As this solves pretty much everything very smooth, I would like to recommend this, instead of manupilating queries in theme. It’s also easy to adjust limits etc with actions/filters.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom query and 404 error on page 2 (didnt forget paged)’ is closed to new replies.