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(){

        'Filtered Users', 
        'Filtered Users', 
        1 );
add_action('admin_menu', 'wporg_options_page');
  • You can’t have a URL like that. The admin does not rewrite URLs, so the only way to have that would be to add a filtered.php to the wp-admin directory, which you must not do. You will need to use the normal admin URL format for settings pages. – Jacob Peattie Jul 22 at 14:30
  • Thanks @JacobPeattie – Islam Hanafi Jul 22 at 14:36
  • If this is a working page on your site: http://localhost/wordpress/wp-admin/users.php?page=filtered.php And you want that to be accessed with this URL: localhost/wordpress/wp-admin/filtered.php you could do that with rewrite rules. I'm not sure if that's what you want though as perhaps you're trying to have the menu item URL generated differently? – mozboz Jul 22 at 19:56
  • @mozboz, Yes I want to do so , but I don't know how to use rewrite rules – Islam Hanafi Jul 23 at 1:37

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]


  • This must be added in your root .htacess file above the start of the Wordpress Rules
  • This will not change the URL in the browser. You can add a redirect if you want it to redirect with e.g. [R=301,NC,L]
  • This is untested but should do what you want or get you close to what you need.
  • As per the comments this is only the URL that you can use to access this page, this won't automatically change any URL's that get rendered in Wordpress
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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