[wp-hackers] Multi Level Rewrite Rules with Dynamic Children
BenderisGreat
greglancaster71 at gmail.com
Sun Dec 8 00:45:51 UTC 2013
Trying to add a rewrite rule after a dynamic-ish subdirectory for the
username. Current it is:
add_rewrite_rule('^member/([^/]*)/?', 'index.php?member=$matches[1]',
'top');
this creates the member/username but I would like to add additional rewrite
rules after the dynamic username level. So :
add_rewrite_rule('^member/([^/]*)/messages/',
'index.php?member=$matches[1]', 'top');
I originally set it up as two seperate rewrite rules, one for messages and
one for username, but currently the messages is on the same level as the
username. So you will be on site.com/member/yourname/ and then click
messages and it takes you to site.com/messages/72 or whatever the message
is.
Id like to combine them ideally. So like
add_rewrite_rule('^member/(.+?)/messages/([^/]*)/?,
'index.php?member=$matches[1]&message=$matches[2]', 'top');
I tried this though without success. I also downloaded a rewrite plugin
that helps with choosing the correct arguments, but it wasn't much help for
me in this situation. Has anyone here ever done something like this? The
finished product would be member/-dynamic-/message/-dynamic-/
--
View this message in context: http://wordpress-hackers.1065353.n5.nabble.com/Multi-Level-Rewrite-Rules-with-Dynamic-Children-tp43022.html
Sent from the Wordpress Hackers mailing list archive at Nabble.com.
More information about the wp-hackers
mailing list