WordPress ReWrite Rules Username Base

时间:2015-12-04 21:18:25

标签: php regex wordpress url-rewriting

I'm trying to create a rewrite rule that would let me catch usernames like

mydomain.com/{username}

By using a rule sort of like:

'([a-zA-Z0-9\._-]+)/?$' => 'index.php?pagename=profile&username=$matches[1]'

However, this would impact all page queries. For example, I still want mydomain.com/about to return the About page, not a username.

Is there anyway I can use the Rewrite API to insert this rule only if the match is an existing username?

0 个答案:

没有答案