Doing something wrong, can't figure out what..Any help is highly appreciated for sure!
I have a custom post type which I want to add query vars to in permalink structure.. So far so good....
This is wordking right: http://allehondenrassen.nl/kennel?artist=queen&genre=pop
This is not working: http://allehondenrassen.nl/kennel/queen/pop/
in my archive-kennels.php I added:
echo get_query_var('artist');
echo get_query_var('genre');
In functions.php I added:
add_filter('page_rewrite_rules', 'dvd_rewrite_rules');
function dvd_rewrite_rules($rules)
{
global $wp_rewrite;
// custom post type name
$dvd_post_type = 'kennels';
$dvd_rule = array(
// Custom Rewrite Slug = kennel
'kennel/(.+)/(.+)/?' => 'index.php?post_type=' . $dvd_post_type . '&artist=$matches[1]&genre=$matches[2]'
);
return array_merge($dvd_rule, $rules);
}
add_filter('query_vars', 'dvd_query_vars');
function dvd_query_vars($vars)
{
$dvd_vars = array(
'artist',
'genre'
);
return array_merge($dvd_vars, $vars);
}
Playing with this for hours but can't see the problem... Thanks in advance! Bas
Settings > Permalink > Save Changes– imHavoc Nov 27 '11 at 0:24