php - URL parameter in WordPress mod_rewrite URL to fake subpath -
i know there other questions, none of them have answers work this.
i have page on wordpress site slug profile
, , have set take ?username=
url parameter. however, ugly, , able go http://website.com/profile/andy
instead of http://website.com/profile/?username=andy
. there can put in functions.php
this? have:
add_filter('query_vars', 'parameter_queryvars'); function parameter_queryvars($qvars) { $qvars[] = 'id'; $qvars[] = 'username'; $qvars[] = 'profileredirect'; $qvars[] = 'reason'; return $qvars; }
this prevents wordpress stripping id
, username
, profileredirect
, or reason
url. once rewritten, still need able use http://website.com/profile/?profileredirect=true&reason=andy
. live without id
, it's not referenced anywhere , there because haven't removed it.
thanks!
Comments
Post a Comment