php - How rename wp-content and wp-admin folders correctly

admin2025-01-08  4

I've readed that using some constant defined into the wp-config.php file is possible to use a custom folder instead of the default wp-content. The same thing if I've understood can be applied also to wp-admin folder. The constant are the following

//Rename wp-content folder
define ('WP_CONTENT_FOLDERNAME', 'Folder_Name');

//Define new directory path
define ('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME);
 
//Define new directory URL
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_CONTENT_URL', WP_SITEURL . WP_CONTENT_FOLDERNAME);

I'm not sure if this will cause problem for wp-content folder, for the wp-admin this seems not work. Is this possible or I need to leave the things as is?

I've readed that using some constant defined into the wp-config.php file is possible to use a custom folder instead of the default wp-content. The same thing if I've understood can be applied also to wp-admin folder. The constant are the following

//Rename wp-content folder
define ('WP_CONTENT_FOLDERNAME', 'Folder_Name');

//Define new directory path
define ('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME);
 
//Define new directory URL
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_CONTENT_URL', WP_SITEURL . WP_CONTENT_FOLDERNAME);

I'm not sure if this will cause problem for wp-content folder, for the wp-admin this seems not work. Is this possible or I need to leave the things as is?

Share Improve this question asked Aug 19, 2023 at 7:43 OHICTOHICT 1337 bronze badges 2
  • you've misunderstood the question you linked to, wp-admin cannot be renamed, the accepted answer says it is not possible – Tom J Nowell Commented Aug 21, 2023 at 13:07
  • Late answer but if the desire is to disguise the URLs to frustrate hackers, there is a plugin, Hide My WP Ghost, that doesn't change any file names but hides the paths. – Mark Lee Commented Nov 19, 2024 at 23:13
Add a comment  | 

1 Answer 1

Reset to default 3

To rename the wp-content and wp-admin folders in WordPress, you can use constants defined in the wp-config.php file. The following constants can be used to rename wp-content folder:

define('WP_CONTENT_FOLDERNAME', 'Folder_Name');
define('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME);
define('WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/' . WP_CONTENT_FOLDERNAME);

For wp-admin folder, renaming it using constants is not recommended as it may cause issues with WordPress core files. It is recommended to leave the wp-admin folder as is.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736268810a1304.html

最新回复(0)