I have url http://domain.com/real-estate-news/phuket-luxury-property-in-high-demand-ms
Where “real-estate-news” is category and “phuket-luxury-property-in-high-demand-ms” is the post name .
when I print $wp_query->query_vars[‘name’]; it gives the post slug and $wp_query->query_vars[‘category_name’] gives the category slug.
I want to generate a new url like http://domain.com/real-estate-news/phuket-luxury-property-in-high-demand-ms/xyz
and want to get xyz in query var like
echo $wp_query->query_vars['name']; // print "phuket-luxury-property-in-high-demand-ms"
echo $wp_query->query_vars['category_name']; // print "real-estate-news"
echo $wp_query->query_vars['section']; //print "xyz"
How to add section query var in wordpress please help me
Is this a Custom Post Type? If it is, you have more options than not. Within the register_post_type()’s array you can enter an argument for ‘rewrite’ to change the slug name and hack in specific rewrite rules for that particular CPT. I have put this project away because of its complexity and if you find an answer I’d love to hear it. Here is my notes on the matter.
dreamdare.org
shibashake.com1
shibashake.com2
Beware of wp.tutsplus very often misinformation is offered there by authors themselves.
wp.tutsplus.com
The way I managed to do this is adding a rewrite rule.
This will look very similar to the one that custom post type creates but also receives a third parameter.
so in your case the rewrite rule would look like this