Shorter admin url for options page
-
20-04-2021 - |
Pergunta
Is it possible to create a short admin url for options page?
The default admin url is:
domain.com/wp-admin/admin.php?page=options-page-slug
And i want it to be: domain/wp-admin/options-page-slug
Solução
You mean, wp-admin/admin.php?page=options-page-slug
?
But yes, you can use the rewrite API:
add_action( 'init', function () {
// The following adds the rule into the database.
add_rewrite_rule(
'wp-admin/options-page-slug(/|$)',
'wp-admin/admin.php?page=options-page-slug',
'top'
);
} );
Or alternatively, just add this before the WordPress rules in your .htaccess
file:
RewriteRule ^wp-admin/options-page-slug(/|$) /wp-admin/admin.php?page=options-page-slug [QSA,L]
Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange