• Resolved af.

    (@af-1)


    I have a page template that produces different results based on a ?year=x parameter on the end of the URL, eg wordpress.com/page/?year=2011

    This works fine for some ‘year’ values but for others it doesn’t load the page and instead redirects to a random posts (which is from the year specified and has the page slug in its title).

    Is the ‘year’ parameter reserved by WordPress?

    To try and make it work I added this code to my functions.php

    function minisite_query_vars($vars)
    {
        $vars[] = 'year';
        return $vars;
    }
    add_filter('query_vars', 'minisite_query_vars');

    … and am accessing it using get_query_var(‘year’) but it still does not work as I would like.

    Any ideas on how to get this working? Thanks in advance.

Viewing 1 replies (of 1 total)
  • Thread Starter af.

    (@af-1)

    Gave up waiting for replies 🙁

    For future reference, year does appear to be reserved so I just changed to y and it now works as I want.

Viewing 1 replies (of 1 total)

The topic ‘Page with custom URL parameter redirects’ is closed to new replies.