php - Wordpress - add_rewrite_rule not passing $matches variable -


i have added rewrite rule

add_rewrite_rule('^users/([^/]*)/?','index.php?page_id=123&user_slug=$matches[1]','top'); 

the problem correct page being opened, however, custom variable user_slug not being passed. if check query vars

global $wp; print_r($wp->query_vars); 

only page_id printed out. how pass other variable there?

make sure registering custom query variable wordpress before make rewrite call:

add_rewrite_tag( '%user_slug%', '([^/]*)' ); 

http://codex.wordpress.org/rewrite_api/add_rewrite_tag


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -