jeudi 26 mars 2015

Wordpress Rewrite Issue


I created a custom taxonomy, two actually (one tag and one category), for a page that lists a series of community projects. This is the parent URL:



http://ift.tt/1D0Srzu


If you go here you'll see ALL the projects. I've successfully set up query vars so that if you enter say:



http://ift.tt/1IxUkCq


or



http://ift.tt/1D0SpHM


everything works as it should. It's perfect. Now, naturally, I'm trying to set up pretty permalinks so that users would simply be able to enter



http://ift.tt/1IxUkCr


and



http://ift.tt/1D0SpHO


respectively. I feel as if the issue may have something to do with the fact that I'm trying to rewrite on a child page of the root (/community)


Anyhow, this is my rewrite function. I've tried a bunch of deviations but I can't see to hit the mark here. I'm remembering to flush as well.



add_action('init','add_community_rewrite_rules');
function add_community_rewrite_rules()
{
add_rewrite_rule(
'tag/(\d*)$',
'index.php?pagename=community&stencil-tag=$matches[1]',
'top'
);

add_rewrite_rule(
'type/(\d*)$',
'index.php?pagename=community&stencil-type=$matches[1]',
'top'
);
}


If anyone sees the error of my ways here and can point me in the right direction I'd be incredible appreciative. Thanks.





Aucun commentaire:

Enregistrer un commentaire