0

WordPress add_menu_page and add_submenu_page support adding custom page. The page created have url with a slug similar to wp-admin/admin.php?page=our-custom-page

How can create a admin page which will have a slug similar to wp-admin/admin.php/our-custom-page

I also want the pages to support inner routing similar to wp-admin/admin.php/our-custom-page

I know it can be done with server settings, I'm looking for way to created this from a theme/plugin.

The main goal is to create the custom admin page without any "?" of url params. The route is less important is long that it's inside wp-admin/

2 Answers 2

0

How can create a admin page which will have a slug similar to wp-admin/admin.php/our-custom-page

You can't, this is not possible in WP Admin

Unlike the frontend, WP Admin does not support pretty URLs, and has no rewrite rules system to plug into. What you're already using is the closest available solution.

0

This answer may be late for too long, but I just want to share my solution with future readers.

tldr;

# Inside your .htaccess

<IfModule mod_rewrite.c>
...
...

RewriteRule ^index\.php$ - [L]

# Add This Line To your .htaccess file
RewriteRule ^wp-admin/our-custom-page/?$ wp-admin/admin.php?page=our-custom-page [L]
...
...
</IfModule>

Let me know if you have any questions :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.