escape($_POST['newdir']); rename(trailingslashit(ABSPATH) . $olddir, trailingslashit(ABSPATH) . $newdir); $conf_f = trailingslashit(ABSPATH).'/wp-config.php'; $scanText = "/* That's all, stop editing! Happy blogging. */"; $newText = "define('WP_CONTENT_DIR', '" . trailingslashit(ABSPATH) . $newdir . "');\r\ndefine('WP_CONTENT_URL', '" . trailingslashit(get_option('siteurl')) . $newdir . "');\r\n\r\n/* That's all, stop editing! Happy blogging. */"; chmod($conf_f, 0755); $handle = @fopen($conf_f, "r+"); if ($handle) { while (!feof($handle)) { $lines[] = fgets($handle, 4096); } fclose($handle); $handle = @fopen($conf_f, "w+"); foreach ($lines as $line) { if (strstr($line,"WP_CONTENT_DIR") || strstr($line,"WP_CONTENT_URL") ) { $line = str_replace($line, "", $line); } if (strstr($line, $scanText)) { $line = str_replace($scanText, $newText, $line); } fwrite($handle, $line); } fclose($handle); } if (isset($errorHandler)) { echo '

' . $errorHandler->get_error_message() . '

'; } else { echo '

content directory successfully changed.

'; } } function getDir() { if (defined('WP_CONTENT_DIR') && defined('WP_CONTENT_URL')) { $dir = WP_CONTENT_DIR; $ls = strripos($dir,'/') + 1; $dir = substr($dir, $ls, strlen($dir)); } else { $dir = 'wp-content'; } return $dir; } if (!isset($_POST['BWPS_content_save'])) { ?>

Better WP Security - Content Directory

Change Content Directory

Select a new name for the content directory.

Better WP Security - Content Directory

Change Content Directory

The directory has been changed please reload this page if you wish to change it again.