How to Hide the wp-content Folder in WordPress (Path Masking Done Right)

Request log card showing plugin folder requests returning 404 after the path moves

Every WordPress install keeps plugins, themes and uploads under /wp-content/, so bots already know where to look. Once a bot finds a plugin folder, it reads the version and fires a matching exploit. Changing the path removes that starting point.

Why the standard wp-content path is a liability

This is the attack chain when the path is standard:

  1. A scanner requests /wp-content/plugins/<name>/readme.txt and reads the exact version.
  2. It matches that version against a public vulnerability database.
  3. If a known flaw exists, it sends the exploit straight to the folder it already knows.

Fingerprinting: one exposed path tells an attacker a lot

Scanners fingerprint your site by requesting known asset paths. A CSS file under /wp-content/plugins/elementor/assets/ confirms a specific page builder. A script under /wp-content/plugins/woocommerce/ confirms a store.

Uploads exposure

On many WordPress sites, the uploads folder returns a full file listing. That exposes PDFs, invoices and client documents.

Two ways to change your wp-content path

Edit wp-config.php by handOne-click path security tool
What it doesRelocates the directory with two constantsRewrites the path the browser sees, through URL rewriting rules. The files stay put
ReferencesDoesn’t update the hundreds already hard-coded in your database, theme files, CDN settings and pluginsUpdates 100+ references (CDN URLs, plugin asset paths, theme calls) automatically
RiskBroken images, missing stylesheets, plugins that can’t find their assetsBuilt to run without conflicts with plugins that depend on those paths
FitsA fresh installAny site with history

Option 1: edit wp-config.php

WordPress lets you relocate wp-content with constants in wp-config.php:

define( 'WP_CONTENT_DIR', dirname(__FILE__) . '/assets' );
define( 'WP_CONTENT_URL', 'https://yourdomain.com/assets' );

Option 2: a path security tool

WP Ghost’s path security features rewrite the path and keep internal references intact.

Change your wp-content path safely, step by step

On a live store, use the one-click path change and flush every cache straight after, not a hand-edited wp-config.php.

  1. Back up first. Take a full backup of files and database before you touch any path. It’s your undo button.
  2. Change the wp-content path. Set a new, non-obvious name in your path security settings and save. The walkthrough is here: change the wp-content path.
  3. Change the plugins path. Give the plugins folder its own path so /wp-content/plugins/ stops resolving. See change the plugins path and hide plugin names.
  4. Change the uploads path. This closes the forced-browsing exposure. The steps are in change the uploads path.
  5. Flush every cache. Clear page cache, object cache and CDN cache so old paths stop being served.
  6. Test the front end and the back end. Load the homepage, a post and the editor. Check that images, styles and scripts load. In dev tools, confirm no request still points at the old /wp-content/ location.
  7. Confirm the old paths return 404. Request /wp-content/plugins/ directly. A 404 means the reconnaissance path is closed.

You can manage all of these in one place. See how to customize all your WordPress paths from one screen. The complete hack prevention guide covers the layers around path security.

What changing the path does and doesn’t do

FAQ

Will changing the wp-content path break my site or my plugins?

It can, if you do it by hand and miss a reference.

Does changing the wp-content path break my CDN?

Not if the rewrite updates your CDN URLs with everything else.

Is hiding wp-content enough to secure my WordPress site on its own?

No. Keep core, plugins and themes updated too.

Can I change the wp-content path without a plugin?

Yes, with WP_CONTENT_DIR and WP_CONTENT_URL in wp-config.php.