Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Admin username and password

Here’s an easy way to enumerate user names (using standard WP install): just use a URL like this: https://www.example.com/?user=1 . (Added Note: you might need to use an actual page/post URL, as in https://www.example.com/a-real-page?user=1 .) You’ll get back info about that user account (the first user account, which will be the admin-level user), and then you can start brute-forcing access. (In a WP install, the first user created is an admin-level user. So it is likely that the above URL will give you the admin’s user name.

And if you use xmlrpc.prg , which allows multiple requests on the same request, you can do it even faster.

Here’s how you prevent the user enumeration:

function redirect_to_home_if_author_parameter() {
      $is_author_set = get_query_var( 'author', '' );
      if ( $is_author_set != '' && !is_admin()) {
            wp_redirect( home_url(), 301 );
            exit;
      }
}
add_action( 'template_redirect', 'redirect_to_home_if_author_parameter' );

That will redirect any user enumeration requests (the URL I mentioned) unless you are already logged in as admin.

And, another precaution is to disable xmlrpc.prg. And to not have a user named ‘admin’ (or if you do, change it to a non-admin level).

Disable xmlrpc.prg (which has lots of opportunities for hacking your site) with this:

add_filter('xmlrpc_enabled', '__return_false');

Place both code fragments in your functions.php (preferably in your Child Theme). Or you can create a simple plugin with the above code.

More about the user enumeration problem in my blog here.

Related Posts:

  1. WordPress custom login form using Ajax
  2. Cannot access wp-admin/wp-login.php (WordPress backend) anymore, what could be wrong?
  3. How can I open up my administrative panel to everyone?
  4. I installed WordPress locally now how do I login?
  5. Help with accessing wp-admin page and resolving error messages
  6. How to replace wp-admin login page to another location?
  7. How to change wp-admin and wp-login urls
  8. Cannot access wp-admin (wordpress dashboard)
  9. Remove metabox from WordPress menu editor page?
  10. How to debug my custom login form looping intermittently
  11. How to make my custom widget appear within WordPress widgets? Plugin development
  12. Generating an nonce for Content Security Policy and all scripts – How to make it match/persist for each page load?
  13. 404 redirect wp-login and wp-admin after changing login url [closed]
  14. getting logged in user info (wp-load.php) from parent directory
  15. Cannot execute php files in wp-content
  16. PHP version problem?
  17. Programmatically create page when saving custom post type post
  18. WordPress admin is incredibly slow [closed]
  19. inserting a post from an extern php file but post content doesn’t show on wp site
  20. How do I get around “Sorry, this file type is not permitted for security reasons”?
  21. Problem with login form
  22. Login to wordpress by clicking a link and specifying usernaname and password in url
  23. Security: blocking direct access of php files
  24. How to change menu labels
  25. Log in / Log Out Custom Button
  26. Should `wp_login` be used since it’s deprecated?
  27. WordPress admin-ajax.php
  28. How to redirect users based on role and content of redirect_to?
  29. Correct and safe way to include php content in my page
  30. Change CSS based on is_user_logged_in
  31. How to display login form anywhere, when user isn’t logged in, without redirecting?
  32. How do I modify the custom footer text and get theme version number to show in wordpress admin?
  33. Password minimum length in personal subscription [closed]
  34. How to add API security keys into JS of wordpress securely
  35. Is it best to avoid using $wpdb for security issues?
  36. Hardening uploads folder in IIS breaks images
  37. WordPress ajax-action failing because of newline in response
  38. get_total () returns 0 – woocommerce [closed]
  39. Troll the hackers by redirecting them
  40. Link blogname and blogdescription to the Options Framework
  41. retain querystring values when savincustom options in admin
  42. Security updates to 3.3.2
  43. Usage of call back function of add_meta_box()
  44. how to prevent wordpress admin from logging in via woocommerce my-account page
  45. AJAX wp_insert_user WORKS but responds with “The site is not enabled”
  46. WordPress wp-admin redirect and exception
  47. malware undetectable by multiple scans
  48. How can I add a new row in a separate database when someone registers via WordPress?
  49. Decoded malware code [closed]
  50. One account with multiple logins
  51. Override Admin menu icon
  52. Lost in trying to create user database system
  53. Using admin-post.php for admin form but it directs me to admin-post.php white screen
  54. Shortcode to log user into current URL
  55. WordPress redirects to old login after migration
  56. PHP getting error when trying to access WP-Admin Dashboard
  57. If user is logged in not working
  58. Change homepage content if user is logged in – BuddyPress
  59. Updating From Mobile App – Exposing Site to Hacking
  60. How to debug failed changes to posts?
  61. Show login greeting above sub-menu links?
  62. Aspx/Rss feed – failed to open stream: Redirection limit reached
  63. is_user_logged_in returning nothing on custom page
  64. Is there a (offical) way for a theme to deactivate itself and show a message in admin?
  65. security concerns if using html data-* attribute for l10n?
  66. How to correctly escape an echo
  67. Reject all malicious URL requests functions.php
  68. portfolio site – about this site section – is it safe to post some code
  69. How can I update WordPress plugins or WordPress itself in all server?
  70. Removing “There is no account with that username or email address.” error message in “/wp-login.php?action=lostpassword”
  71. Can’t log in to WordPress wp-admin after adding code to functions.php
  72. Search bar for wp menu
  73. Check if user had autologin & if so, logout
  74. Fatal error login WordPress [duplicate]
  75. echo cutom css code to WordPress page template file ? is this safe?
  76. Admin Panel 404 Error after login
  77. PHP warning – Use of undefined constant ‘FORCE_SSL_LOGIN’ ‘FORCE_SSL_ADMIN’ on wp-config.php
  78. How to block specific user id in custom login form?
  79. Log out without confirmation request (nonce)
  80. Has a PHP update given me a 404?
  81. Fatal error: wp-settings.php on line 199
  82. Hide Approved status for certain users in users list
  83. Having trouble creating two shortcodes, one for logged in user and one for visitors
  84. Call WP Rest-Api to GET /users/me returned NOTHING in console
  85. Class ‘WP_Privacy_Requests_Table’ not found
  86. wordpress contact form messages not sending although it saying they were sent successfully with this php code
  87. How to secure my php forms
  88. Restrict wordpress access to logged users only
  89. Infinite loop when logging out using custom login form
  90. $.ajax results in 403 forbidden
  91. Menu not updating for logged in users after redirect
  92. Site infected by link
  93. Save custom field on WP_List_Table
  94. Create “blank” admin page without having admin-bar/admin-menu for faster load
  95. how to use auth_redirect() redirect visitor to login page if they are not login when they click account and order page?
  96. Issues adding Recaptcha v3 to WordPress Registration
  97. Display specific page if user signed in
  98. Change Login or Logout text based on status
  99. How to separate the taxonomies list from the form so that editing taxonmies is the same as pages and posts?
  100. Refresh page after login with litespeed cache
Categories PHP Tags login, php, security, wp-admin
Move WooCommerce product tabs out of the tabs [closed]
Saving html into postmeta without stripping tags – safe?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress