• Features
  • Pricing
  • Help
  • My Account
  • Buy Now
WP Ghost
  • Features
  • Pricing
  • Help
  • My Account
  • Buy Now

Hide wp-admin and wp-login.php from Source Code

/Developers /Hide wp-admin and wp-login.php from Source Code
Table of Contents
  • Why Admin Paths Appear in Source Code
  • Step 1: Change and Hide the Paths
  • Step 2: Verify with Security Check
  • Fix Paths Still Showing After Hiding
  • Frequently Asked Questions
    • Does WP Ghost hide paths for logged-in users too?
    • What is the correct WordPress function for login URLs?
    • Does WP Ghost modify WordPress core files?
  • Related Tutorials

WP Ghost can hide wp-admin and wp-login.php references from your site’s HTML source code. After changing these paths with WP Ghost, the original URLs should no longer appear in the frontend source. If they still show up, it’s usually because a theme or plugin is outputting the paths directly instead of using WordPress functions. This guide covers how to hide the paths, verify they’re hidden, and fix cases where they still appear.

Why Admin Paths Appear in Source Code

Why wp-admin and wp-login.php paths appear in HTML source code and how WP Ghost hides them

WordPress and many plugins output wp-admin and wp-login.php URLs in the frontend HTML source: in admin bar links, login/logout links, comment form URLs, and various plugin-generated markup. Bots scan this source code to discover admin and login paths. WP Ghost replaces these paths in the HTML output, but plugins that hardcode paths (instead of using WordPress functions like admin_url()) can bypass WP Ghost’s replacement.

Step 1: Change and Hide the Paths

First, make sure you’ve changed and hidden both admin paths in WP Ghost:

  • Change and hide the wp-admin path
  • Change and hide the wp-login.php path

Both paths need to be changed (renamed to custom URLs) and hidden (original paths return 404 or a custom page) for maximum protection.

Step 2: Verify with Security Check

After hiding the paths, run a security check to confirm they no longer appear in the source code:

  1. Go to WP Ghost > Security Check.
  2. Run the check and review the results.
  3. If the paths are correctly hidden, the security check shows them as passing.
  4. If the paths still appear, follow the troubleshooting steps below.

You can also verify manually: open your site in an incognito browser window (logged out), view the page source (Ctrl+U), and search for wp-admin and wp-login. If either term appears, something is still outputting the original paths.

Fix Paths Still Showing After Hiding

If wp-admin or wp-login.php still appear in the source code after enabling WP Ghost’s hide options, a theme or plugin is hardcoding the paths instead of using WordPress functions.

To identify the source:

  1. Deactivate all plugins except WP Ghost.
  2. Check the source code again. If the paths are gone, a plugin was the cause.
  3. Reactivate plugins one at a time, checking the source code after each, to identify which plugin exposes the paths.
  4. If the paths still appear with all plugins deactivated, your theme is the cause. Switch to a default WordPress theme (Twenty Twenty-Four) temporarily to confirm.

Once you identify the plugin or theme, contact the developer and ask them to use WordPress functions instead of hardcoded paths:

  • For wp-admin: use admin_url('/') instead of hardcoding /wp-admin/
  • For wp-login.php: use wp_login_url() instead of hardcoding /wp-login.php

When plugins and themes use these WordPress functions, WP Ghost can intercept and replace the paths with your custom URLs automatically.

Text Mapping as a workaround. If the plugin developer can’t fix the hardcoded paths, you can use WP Ghost’s Text and URL Mapping feature to find and replace the remaining wp-admin or wp-login.php references in the HTML output.

Frequently Asked Questions

Does WP Ghost hide paths for logged-in users too?

By default, WP Ghost hides paths in the frontend for all visitors, including logged-out users and bots. Logged-in admin users may still see original paths in the WordPress admin bar. To extend path changes to the admin dashboard, see Change Paths in Admin Dashboard.

What is the correct WordPress function for login URLs?

The correct function is wp_login_url(). This returns the login URL and respects custom login paths set by security plugins like WP Ghost. Some older documentation references home_url('wp-login.php'), but wp_login_url() is the proper WordPress function because it supports filters.

Does WP Ghost modify WordPress core files?

No. WP Ghost replaces paths in the HTML output buffer using WordPress hooks. No core files are modified. The paths are changed dynamically at render time.

Related Tutorials

Admin and login path security:

  • Change and Hide the wp-admin Path – Rename and hide wp-admin.
  • Change and Hide the Login Path – Rename and hide wp-login.php.
  • Text and URL Mapping – Replace hardcoded paths in HTML output.
  • Change Paths in Admin Dashboard – Extend path changes to the admin area.
Tagged: hide wp-adminhide wp-logintext mapping

Related Articles

  • Stop WP Ghost Auto Update Check | wp-config.php

  • Add a Custom CMS Simulator in WP Ghost

  • WP Ghost Constants in wp-config.php

  • Change Paths in WordPress Admin Dashboard

  • Add Files to Hide WordPress Common Files

  • Change or Remove WordPress Login Logo Link

WP Ghost 9.0

WP Ghost 9.0 is the most significant release since the plugin was renamed from Hide My WP Ghost. This update introduces a redesigned security dashboard with a real-time Security Optimization Score, a customizable login page designer, Copyright protection from AI Crawlers, interactive threat geography mapping, and more.

Wp Ghost 9

WP Ghost - Best Practice

Learn how to set up WP Ghost in Ghost Mode and activate all the security features you need for a stronger and safer website.

Most Popular

  • How to Change the admin-ajax.php Path in WordPress
  • WP Ghost Compatible Plugins and Themes List
  • What is WP Ghost?
  • Lesson 3 – Hide Your Site from WordPress Theme Detectors and Bots
  • How to Change and Hide wp-admin Path in WordPress
  • Lesson 1 – Customize Paths and Hide Your WordPress Website
  • WP Ghost Settings – Best Practice
  • Install WP Ghost Free Plugin for WordPress
  • Setup WP Ghost on Nginx Server Guide
  • WordPress Security Check – 40 Security Tasks
  • Theme Not Loading Correctly and Website Loads Slower
  • How to Configure WP Ghost Firewall Protection
  • WP Ghost Compatible WordPress Themes List
  • WP Ghost – Changelog
  • Set AllowOverride All on Apache Servers Step by Step
  • How To Change WordPress File Permissions for Security
  • WordPress Brute Force Protection with reCAPTCHA
  • How to Change the Plugins Path in WordPress
  • Change Paths in WordPress Admin Dashboard
  • Activate WordPress Debugging | WP Ghost Guide
  • Two-Factor Authentication (2FA) for WordPress
  • How to Change and Hide wp-login Path in WordPress
  • How to Change Paths in Cached Files with WP Ghost
  • How to Change the REST API Path and Disable XML-RPC
  • Disable WP Ghost In Case Of Error
  • How to Change the Registration Path in WordPress
  • How to Configure Redirects in WP Ghost
  • Hide wp-admin and wp-login.php from Source Code
  • Add Brute Force Protection to Elementor Login Forms
  • Hide WordPress from Wappalyzer | WP Ghost Guide

Product

  • What is WP Ghost?
  • Free vs Premium
  • Pricing
  • Changelog
  • Why WP Ghost
  • Knowledge Base

Features

  • Path Security
  • Firewall Security
  • Brute Force Protection
  • Two-Factor Authentication
  • User Events Log
  • Security Threats Log

Resources

  • Getting Started Guide
  • Plugin Compatibility
  • Theme Compatibility
  • Hosting Setup Guides
  • Developer Hooks
  • FAQs

Company

  • Affiliate
  • Media Kit
  • Terms Of Use
  • Privacy Policy
  • GDPR Compliance
  • Contact
  • Facebook
  • YouTube
  • X
© WP Ghost 2016-2026 | Powered by AISQ | Squirrly