Passing URL arg with permalinks
-
I have a web site <http://www.wessexmc.org.uk/> which uses quite a bit of custom code, implemented as a plugin. These use parameters passed in the URL. e.g. <http://www.wessexmc.org.uk/?page_id=234&year=2015&month=2>
This all works fine, but I would like to change to name based permalinks to make the URLs more readable.
I am trying this on a test version of the site. e.g <http://test.wessexmc.org.uk/?page_id=234&year=2015&month=2>
When I change to named permalinks the base page is <http://test.wessexmc.org.uk/hut/hut-calenda-and-booking/> which is fine but <http://test.wessexmc.org.uk/hut/hut-calenda-and-booking/?year=2015&month=2> gives a 404 page not found error.
I read I needed to tell wordpress about the parameters (although that was not necessary before). So I tried code like this:
add_filter(‘query_vars’, ‘add_my_var’);function add_my_var($public_query_vars) {
$public_query_vars[] = ‘month’;
$public_query_vars[] = ‘year’;
return $public_query_vars;
}But that made no difference.
Anybody help with what I need to do to make this work?
Thanks
The topic ‘Passing URL arg with permalinks’ is closed to new replies.