Rewrite rules only handle incoming requests, they aren’t involved in link generation.
The primary WordPress rewrite system is parsed internally with PHP, you won’t see any changes to an .htaccess
file when you add an endpoint. The basic .htaccess rules essentially say “If this isn’t a request for a physical file or directory on the server, then hand the request over to WordPress”.
Your account_url
function has to handle both “ugly” and “pretty” cases when it outputs the account URLs. We can look at the built in get_permalink
function to see how WordPress handles this, here’s an abbreviated version:
$permalink = get_option('permalink_structure');
if ( '' != $permalink ) {
// output a pretty permalink
} else {
// output an ugly permalink
}
The permalink_structure
option holds the chosen pattern if pretty permalinks are enabled, we know pretty permalinks are disabled if it’s empty.