I am trying to rewrite URL in my custom post type. This is the existing URL I am able to access:
http://domainname.com/new/projects/s-test-uco-10/
But I want to access the URL like this
http://www.domainname.com/new/projects/mail/s-test-uco-10/
Below is my code:
add_action('init', 'add_my_rule');
function add_my_rule()
{
global $wp;
$wp->add_query_var('args');
add_rewrite_rule('^projects/mail.*$','index.php?projects','top');
}
s-test-uco-10
is the post name, I want to pass this name dynamically.
please try below code .. hope it will help you