Last active
August 29, 2015 14:17
-
-
Save filippo/28285291501bbc775abd to your computer and use it in GitHub Desktop.
wordpress tips and tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To put a wordpress website in maintenance mode add a file .maintenance in the root folder with the following content: | |
<?php $upgrading = time(); ?> | |
change the $upgrading value to an integer eg. | |
<?php $upgrading = 1234567890; ?> | |
1234567890 is the linux timestamp. The website will be offline up to the timestamp + 10 minutes. | |
From: http://sivel.net/2009/06/wordpress-maintenance-mode-without-a-plugin/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
After wp-settings.php determines whether or not to put the blog into maintenance mode (see maintenance-mode.php) it checks to see if there is a file titled maintenance.php located in WP_CONTENT_DIR which is by default wp-content/. | |
Simply create a file at wp-content/maintenance.php containing the code you want to display the for the maintenance page. Below is a sample of code based off of the default maintenance page. | |
<?php | |
$protocol = $_SERVER["SERVER_PROTOCOL"]; | |
if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol ) | |
$protocol = 'HTTP/1.0'; | |
header( "$protocol 503 Service Unavailable", true, 503 ); | |
header( 'Content-Type: text/html; charset=utf-8' ); | |
?> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<body> | |
<h1>Briefly unavailable for scheduled maintenance. Check back in a minute.</h1> | |
</body> | |
</html> | |
<?php die(); ?> | |
From: http://sivel.net/2009/06/wordpress-maintenance-mode-without-a-plugin-part-2/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
this gist contains various tips and tricks for wordpress management and development |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install a blog from the command line | |
# | |
# First thing to do: create mysql database and user | |
# then download wordpress | |
wp core download | |
# configure database access | |
wp core config --dbname=DBNAME --dbuser=DBUSER --dbpass=DBPASS | |
# install wordpress | |
wp core install --url=http://sitename.com/ --title="Site title" --admin_user=myusername --admin_password=mypassword --admin_email=my.email@whatever.com | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Rename a site | |
# | |
# note: use option --allow-root to run commands as root | |
wp search-replace 'http://example.dev' 'http://example.com' | |
# Or, if you only want to change the option, you can do: | |
wp option update home 'http://example.com' | |
wp option update siteurl 'http://example.com' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment