Rewrite rule not matching
I tested the suggestion from my comment and it worked. Remove the brackets from (myaccount) and change $matches[2] in the URL to myaccount: function wpse_287203_rewrite_rule() { add_rewrite_rule( ‘^user/(\d+)/myaccount/?’, ‘index.php?pagename=myaccount&user_id=$matches[1]’, ‘top’ ); } add_action( ‘init’, ‘wpse_287203_rewrite_rule’ ); (myaccount) will not match a whole world. That’s a little more involved. See this Stack Overflow answer for how … Read more