admin管理员组文章数量:1122846
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/
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
Reset to default 0How 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.
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 :)
本文标签: pluginsAdd custom WordPress admin page with pretty url via code
版权声明:本文标题:plugins - Add custom WordPress admin page with pretty url via code 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736285714a1927516.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论