Is it possible to create a short admin url for options page?
The default admin url is:
domain/wp-admin/admin.php?page=options-page-slug
And i want it to be: domain/wp-admin/options-page-slug
Is it possible to create a short admin url for options page?
The default admin url is:
domain/wp-admin/admin.php?page=options-page-slug
And i want it to be: domain/wp-admin/options-page-slug
Share Improve this question edited Jul 10, 2020 at 10:49 user315338 asked Jul 4, 2020 at 22:01 user315338user315338 1151 gold badge1 silver badge6 bronze badges1 Answer
Reset to default 1You 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]