$tag = '(.+?)';
And maybe it’s better to take into account the start ^ and end $ of the string to all other rules
]]>So I wrote this code:
add_rewrite_rule('cd/([^/]*)-([^/]*)$','index.php?post_type=cd&cd=$matches[1]&singers=$matches[2]','top');
But it doesn’t work.
If I wrote:
^cd/([^/]*)/([^/]*)?
instead ^cd/([^/]*)-([^/]*)?
( https://localhost/cd/cdname/singername instead https://localhost/cd/cdname-singername ) it works…
How can I resolve? Thanks.
]]>I’d like to rewrite URL in => example.com/wordpress/cd/namecd-term
So I write this (it works):
add_rewrite_rule('^([^/]*)-cd-([^/]*)/?','?post_type=cd&cd=$matches[1]&cantanti=$matches[2]','top');
But if I go to into archive “cd”, the url of post is example.com/wordpress/cd/namecd and not example.com/wordpress/cd/namecd-term
How can I resolve? Thanks…
]]>I have a blog with custom post type “Event” (slug: “event”) and a taxonomy “cat-event”.
The taxonomy “cat-event” has some category as “Party”, “Birthday”, “Concert”, …
When I write a new post event, I have this URL => www.example.com/event/name-post-event
While I’d like this URL => www.example.com/party/name-post-event
(So, I don’t want to show “event”, but the category of the taxonony.)
How can I resolve with add_rewrite_rules()? Thanks.
]]>www.foo.com/?page=a_plugin&q=one/two/three&id=3
WHen the email recipient clicks on the link it goes to the index page. I want it to go to another page, say:
www.foo.com/a_plugin?q=one/two/three&id=3
with the very same parameters. Is this a job for add_rewrite_rules()?
If so, if I add ‘page’ to query_vars with add_filter(), will that break something predefined about ‘page’?
Is that ‘page’ tag in the original url special in WordPress?
Basically, I want to take that first query string parameter, page=a_plugin and redirect to whatever the page parameter points to, in this case “a_plugin”.
Additionally, I can’t modify the URL in the email because the code that generates it can’t be modified.
Thanks in advance,
George
‘explorec/([^/]+)/?$’ => ‘index.php?pagename=explorec&city=$matches[1]’
this rule works fine. Clean and passes the new variable “city” but when i add two variables i get 404 error. The following rewrite rule gives me a 404 error.
‘explorec/([^/]+)/([^/]+)?$’ => ‘index.php?pagename=explorec&city=$matches[1]&zip=$matches[2]’
The above gives the error. Can someone explain to me why the first example with one variable works fine and the one with two doesn’t work. Also if someone can offer me a solution, that would be great. Thank you so much.
I also am using add_query_vars to accomplish the add_rewrite_rules. I also have my permalinks set to postname.
]]>