I have custom post types registered and they are working fine with their normal URLs. My Custom post types have 'members' as their slug. Now I am trying to have a custom permalink for my custom post types. Here is my $wp_write->add_rule
$wp_rewrite->add_rule('members/.+?/(.+)/$','index.php?post_type=pasha_members&name=$matches[1]', 'top');
Below is my $wp_rewrite->rules array.
array(
['members/.+?/(.+)/$'] => 'index.php?post_type=pasha_members&name=$matches[1]'
['category/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$'] => 'index.php?category_name=$matches[1]&feed=$matches[2]'
['category/(.+?)/(feed|rdf|rss|rss2|atom)/?$'] => 'index.php?category_name=$matches[1]&feed=$matches[2]'
...
);
And here is the url that I am trying to access, I am not able to figure out what I am doing wrong.
http://wp.dev/members/city1-city2/best-compnay/
When I change Permalink settings to default in Settings->Permalink, I can access the custom post just fine using the following url.
http://wp.dev/?post_type=pasha_members&name=best-compnay
Let me know if you need more information. Any help pointers are much appreciated.
NOTE: I have put the add_rule in init instead of activate just for the testing. I also have put the flush_rewrite_rules in the init, its also temporarily until its fixed.