WordPress Development Asked on November 26, 2021
I’m trying to add a sub page under users in admin panel and everything works fine but I have a little problem when clicking on the created page the url changes and refer to my page as query string not new php file
URL : http://localhost/wordpress/wp-admin/users.php?page=filtered.php
and I want : http://localhost/wordpress/wp-admin/filtered.php
is there any way to do so ?
function wporg_options_page(){
add_submenu_page(
'users.php',
'Filtered Users',
'Filtered Users',
'manage_options',
'filtered.php',
'filtered_user_page_html',
1 );
}
add_action('admin_menu', 'wporg_options_page');
As per the requirement in the comments, one way to do that rewrite is with .htaccess. This may be possible with Wordpress rewrite functions too, but I find .htaccess easier as there are some constraints with the Wordpress functions.
If your Wordpress installation is at http://localhost/wordpress
then your .htaccess should be in the wordpress
directory.
Add this to the top of it to do the rewrite you want:
RewriteEngine On
RewriteRule ^wp-admin/filtered.php(/.*)$ wp-admin/users.php?page=filtered.php$1 [NC,L]
Note:
.htacess
file above the start of the Wordpress Rules[R=301,NC,L]
Answered by mozboz on November 26, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP