Support » Fixing WordPress » Query Vars and Permalinks

  • Query vars which are PUBLIC will be used by WP_Query to determine what page should be displayed.

    Something like /?cat=1&author=1&year=2012 will show posts of category ID 1 written by author ID 1 on year 2012

    The same result should be achieve from /2012/?cat=1&author=1. But be aware of the second example, entering such URL will redirect you to /author/something/?cat=1 which I hate. Also entering /?cat=1&author=1 will break the page.

    From what I’ve been aware of, it because such URL will giving false positive where all conditions are meet. Take the first example, it will make all of the is_date(), is_author, and is_category() return true.

    THIS IS BAD! Why?

    First, WordPress behave strangely with this, and doesn’t seem to have consistency on it. WP will redirect people to the proper URL if they enter the query string directly. Entering /?cat=1 for instance, will redirect to /category/uncategorized. What strange is, it doesn’t act the same with /?post_format=image.

    Second, Archives are based on either category, tags, date, author, and now post_format. That what most people believe when design a template like me too. Thus, if you enter the URL on the first example, the loaded page is NOT a Date Archive, NOT an Author Archive, and NOT a Category Archive. It is a HOME, or Posts Page.

    How do you handle this is up to you. Me? I prefer to redirect people to Search Results page whenever they manually entered multiple query_string on URL. By doing this, I’m not breaking any archive page, and not confusing the visitor.

    Just my two cents

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Query Vars and Permalinks’ is closed to new replies.