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() . '
content directory successfully changed.
Select a new name for the content directory.
The directory has been changed please reload this page if you wish to change it again.