Let’s first look at the third type, multiple WordPress instances with multiple databases, because it has the same installation process as the single WordPress site except there are multiple sites.
You’ll need a separate MySQL database for each blog you plan to install. If you have not yet created these, basic instructions are found here.
The wp-config.php file will vary for each installation. The lines to change are the following:
define('DB_NAME', 'wordpress'); // The name of the database define('DB_USER', 'username'); // Your MySQL username define('DB_PASSWORD', 'password'); // ... and password
DB_NAME
is the name of the individual database created for that blog. If you are using different user logins for each database, edit DB_USER
and DB_PASSWORD
to reflect this as well.
Upload each wp-config.php file to its specific root/installation directory, and run the installation. See Installing WordPress for more information.
If you want multiple sites to use WordPress, you can use the multisite feature to create what is referred to as a network of sites. The multisite feature involves installing a single WordPress instance and a single database.
The multisite feature appears to be simpler than other types of multiple WordPress installations, but there are some considerations and restrictions. Refer to the following documents for more detailed information:
As with the multiple-database solution described above, the wp-config.php file will vary for each installation. In this case, however, only a single line is unique to each blog:
$table_prefix = 'wp_'; // example: 'wp_' or 'b2' or 'mylogin_'
By default, WordPress assigns the table prefix wp_
to its MySQL database tables, but this prefix can be anything you choose. This allows you to create unique identifiers for each blog in your database. For example, let’s say you have three blogs to set up, with the names Main, Projects, and Test. You should substitute the prefix wp_
in each blog’s
wp-config.php:
Main blog:
$table_prefix = 'main_';
Projects blog:
$table_prefix = 'projects_';
Test blog:
$table_prefix = 'test_';
As noted, you may use a prefix of your own making. Those provided here are for example only.
Upload each wp-config.php file to its specific root/installation directory, and run the installation. See Installing WordPress for more information.
You can use the same userbase for all your blogs on the same domain by defining the CUSTOM_USER_TABLE
and optionally the CUSTOM_USER_META_TABLE
constants to point to the same wp_your_blog_users
and wp_your_blog_usermeta
tables.
See Editing wp-config.php/Custom User and Usermeta Tables.
Note: Both settings should include the http:// part and should not have a slash “/” at the end.
Every once in a while, somebody finds a need to manually change (or fix) these settings. Usually this happens when they change one or both and discover that their site no longer works properly. This can leave the user with no easily discoverable way to correct the problem. This article tells you how to change these settings directly.
Additional information is presented here for the case where you are moving WordPress from one site to another, as this will also require changing the site URL. You should not attempt to use this additional information if you’re only attempting to correct a “broken” site.
Alert! These directions are for single installs of WordPress only. If you are using WordPress MultiSite, you will need to manually edit your database.
There are four easy methods to change the Site URL manually. Any of these methods will work and perform much the same function.
It is possible to set the site URL manually in the wp-config.php
file.
Add these two lines to your wp-config.php, where “example.com” is the correct location of your site.
define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );
This is not necessarily the best fix, it’s just hard-coding the values into the site itself. You won’t be able to edit them on the General settings page anymore when using this method.
If you have access to the site via FTP, then this method will help you quickly get a site back up and running, if you changed those values incorrectly.
functions.php
file. You’re going to edit it in a simple text editor and upload it back to the site.update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );
Use your own URL instead of example.com, obviously.
3. Upload the file back to your site, in the same location. FileZilla offers a handy “edit file” function to do all of the above rapidly; if you can use that, do so.
4. Load the login or admin page a couple of times. The site should come back up.
Important! Do not leave this code in the functions.php
file. Remove them after the site is up and running again.
Note: If your theme doesn’t have a functions.php
file create a new one with a text editor. Add the <?php tag and the two lines using your own URL instead of example.com:
<?php
update_option( 'siteurl', 'http://example.com' );
update_option( 'home', 'http://example.com' );
Upload this file to your theme directory. Remove the lines or the remove the file after the site is up and running again.
Here are some additional details that step you through transferring a LAN-based WordPress site into an externally accessible site, as well as enabling editing the wordpress site from inside the LAN.
Two important keys are router/firewall modifications and the “wait 10+ minutes” after making the changes at the end.
using ssh to log into your server (nano is a server preinstalled text editor)
$ nano /var/www/books/wp-content/themes/twentyeleven/functions.php
add lines just after <?php
update_option( 'siteurl', 'http://your.site.url:port/yourblog');
update_option( 'home', 'http://your.site.url:port/yourblog');
refresh your web browser using your external site URL:
http://your.site.url:port/yourblog
$ nano /var/www/books/wp-content/themes/twentyeleven/functions.php
remove those lines you just added (or comment them out)
access your router, these steps are for pfSense, other routers should have similar settings to look for/watch out for)
add to firewall/nat table a line like this
wan/tcp/port/LAN.server.IP/80
add to firewall/rules table a line like this
tcp/*/port/LAN.server.IP/port/*
uncheck the box at System/advanced/network address translation/Disable NAT Reflection
"Disables the automatic creation of NAT redirect rules for access to your public IP addresses from within your internal networks. Note: Reflection only works on port forward type items and does not work for large ranges > 500 ports."
Then go do something for ten minutes and when you get back see if the external url http://your.site.url:port/yourblog from a LAN browser brings the page up correctly.
WordPress supports an automatic relocation method intended to be a quick assist to getting a site working when relocating a site from one server to another.
When RELOCATE has been defined as true in wp-config.php
(see next chapter), the following code in wp-login.php will take action:
if ( defined( 'RELOCATE' ) AND RELOCATE ) {
// Move flag is set
if ( isset( $_SERVER['PATH_INFO'] ) AND ($_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) )
$_SERVER['PHP_SELF'] = str_replace( $_SERVER['PATH_INFO'], "", $_SERVER['PHP_SELF'] );
$url = dirname( set_url_scheme( 'http://'. $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] ) );
if ( $url != get_option( 'siteurl' ) )
update_option( 'siteurl', $url );
}
wp-config.php
file.define('RELOCATE',true);
wp-login.php
on the new server. For example, if your new site is at http://www.yourdomainname.com
, then type http://www.yourdomainname.com/wp-login.php
into your browser’s address bar.wp-config.php
and either completely remove the line that you added (delete the whole line), comment it out (with //
) or change the true
value to false
if you think it’s likely you will be relocating again.Note: When the RELOCATE flag is set to true, the Site URL will be automatically updated to whatever path you are using to access the login screen. This will get the admin section up and running on the new URL, but it will not correct any other part of the setup. You’ll still need to alter those manually.
Important! Leaving the RELOCATE constant in your wp-config.php file is insecure, as it allows an attacker to change your site URL to anything they want in some configurations. Always remove the RELOCATE line from wp-config.php after you’re done.
If you know how to access phpMyAdmin on your host, then you can edit these values directly to get your site up and running again.
wp_options
. Note: The table prefix of wp_
may be different if you changed it when installing.wp_options
table.option_name
, scroll down and look for siteurl
.option_value
, carefully change the URL information to the new address.wp_options
table.home
field in the table and click Edit Field. Note There are several pages of tables inside wp_options
. Look for the>
symbol to page through them.option_value
, carefully change the URL information to the new address.When moving sites from one location to another, it is sometimes necessary to manually modify data in the database to make the new site URL information to be recognized properly. Many tools exist to assist with this, and those should generally be used instead of manual modifications.
This is presented here as information only. This data may not be complete or accurate.
You should read the Moving WordPress article first, if attempting to move WordPress from one system to another.
Like many WordPress administrators, you may be running several WordPress installations off of one database using various wp-config.php
hacks. Many of these hacks involve dynamically setting table prefixes, and if you do end up altering your table prefix, you must update several entries within the prefix_usermeta table as well.
As in the above section, remember that SQL changes are permanent and so you should back up your database first:
If you are changing table prefixes for a site, then remember to alter the table prefix in the usermeta tables as well. This will allow the new site to properly recognize user permissions from the old site.
UPDATE `newprefix_usermeta` SET `meta_key` = REPLACE( `meta_key` , 'oldprefix_', 'newprefix_' );
In your WordPress Theme, open each template file and search for any manually entered references to your old domain name and replace it with the new one. Look for specific hand coded links you may have entered on the various template files such as the sidebar.php
and footer.php
. WordPress uses a template tag called bloginfo()
to automatically generate your site address from information entered in your Administration > Settings > General panel. The tag in your template files will not have to be modified.
You will need to update your WordPress configuration file if your database has moved or changed in certain ways.
localhost
wp-config.php
file.wp-config.php
file in a text editor.At this point, your WordPress blog should be working.
After changing the information in your Administration > Settings > General panel, you will need to update your .htaccess
file if you are using Permalinks or any rewrites or redirects.
.htaccess
file. This is not a recommendation but a requirement..htaccess
file in a text editor..htaccess
file..htaccess
file and check to see if your custom rewrites and redirects are still there. If not, copy them from the saved file and paste them into the new .htaccess file.If you make a mistake, you can Restoring Your Database From Backup from your backup and try this again. So make sure it is right the first time.
There are other things you may wish to change in order to correct URLs when moving sites.
Using the Export/Import feature to move a blog to a new domain.
When doing the above and changing the URLs directly in the database, you will come across instances of the URL being located in the “guid” column in the wp_posts
tables. It is critical that you do NOT change the contents of this field.
The term “GUID” stands for “Globally Unique Identifier”. It is a field that is intended to hold an identifier for the post which a) is unique across the whole of space and time and b) never, ever changes. The GUID field is primarily used to create the WordPress feeds.
When a feed-reader is reading feeds, it uses the contents of the GUID field to know whether or not it has displayed a particular item before. It does this in one of various ways, but the most common method is simply to store a list of GUID’s that it has already displayed and “marked as read” or similar.
Thus, changing the GUID will mean that many feedreaders will suddenly display your content in the user’s reader again as if it was new content, possibly annoying your users.
In order for the GUID field to be “globally” unique, it is an accepted convention that the URL or some representation of the URL is used. Thus, if you own example.com, then you’re the only one using example.com and thus it’s unique to you and your site. This is why WordPress uses the permalink, or some form thereof, for the GUID.
However, the second part of that is that the GUID must never change. Even if you shift domains around, the post is still the same post, even in a new location. Feed readers being shifted to your new feeds when you change URLs should still know that they’ve read some of your posts before, and thus the GUID must remain unchanged.
Never, ever, change the contents of the GUID column, under any circumstances.
If the default uploads folder needs to be changed to a different location, then any media URLs will need to be changed in thepost_content column of the posts table. For example, if the default uploads folder is changing from wp-content/uploads to images:
UPDATE wp_posts SET post_content = REPLACE(post_content,'www.domain.com/wp-content/uploads','www.domain.com/images');
See Moving WordPress Multisite
wp-cli is a super useful shell tool.
wp search-replace 'example.dev' 'example.com' --skip-columns=guid
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'
People are often confused about the differences between WordPress and WordPress.com. WordPress is the free, Open Source web publishing software project, owned by no one individual or company. WordPress.com is a hosted blogging service run by a company called Automattic.
WordPress (sometimes called “WordPress.org” or “self-hosted WordPress” for disambiguation purposes), is software that you can download and install on any web host. It began in 2003 as a fork of b2/cafelog. Licensed by the GPL, you are free to use WordPress without restriction. Sites powered by WordPress may have a “Proudly powered by WordPress” credit, or they may have no credit at all. The absence of any mention of “WordPress.com” is a good indicator that it is a self-hosted WordPress instance).
WordPress.com (a.k.a. “wpcom” or “WP.com”) is a for-profit hosted blogging service run by Automattic. WordPress.com launched in 2005, and is the largest WordPress install in the world. It is powered by WordPress, with some additional plugins and modifications layered on. Having “.wordpress.com” in the domain of the blog or the presence of a “Blog at WordPress.com” promo message or credits image can be used to determine whether a site is hosted at WordPress.com.
What is the overlap between WordPress and WordPress.com? First, Matt Mullenweg is both CEO of Automattic, and co-founder of WordPress. Matt is involved with both WordPress and WordPress.com. Some WordPress contributors are also employees of Automattic. There are many more WordPress contributors, most of which have no connection with WordPress.com.
Development decisions about WordPress are made without specific regard to their impact on WordPress.com. Any special changes that WordPress.com needs are made on that side, by Automattic employees.
This video is an overview of the differences between WordPress and WordPress.com:
Automattic’s relationship to WordPress?
Automattic uses WordPress to power WordPress.com, and it contributes back code and time to the WordPress project. It is a symbiotic relationship. It isn’t accurate to say that WordPress is Automattic’s product, or that WordPress came from Automattic. Indeed, the opposite is true — Automattic came from WordPress, and Automattic (through WordPress.com) exists as part of the vast WordPress community and ecosystem.
Why can’t I call WordPress.com just “WordPress”?
Because it isn’t clear what you’re talking about — the Open Source project, or the hosted blogging service. They are distinct, and statements about one aren’t necessarily true about the other. WordPress.com is its name. You wouldn’t call bit.ly, the popular link shortening service, just “bit,” would you?
Why doesn’t Automattic rename WordPress.com to something more distinct?
You’ll have to ask them. Likely, the downsides of a rebranding campaign would outweigh the benefits. The ambiguity certainly hasn’t been all bad. It makes it fairly clear to users that they can migrate their WordPress.com blog to a self-hosted WordPress install.
]]>WordPress Plugins are PHP scripts that extend the functionality of WordPress. They enhance the features of WordPress or add entirely new features to your site. Plugins are often developed by volunteers and are usually free to the public.
Plugins are available via the WordPress Plugin Directory. Although plugins you find here are thoroughly tested and considered safe to use, they are of varying quality and are often works in progress.
The WordPress content management system software, or WordPress core, provides the primary functionality for publishing content and managing users. Each WordPress plugin is an additional piece of software that can be easily installed to extend the functionality of WordPress core.
This allows you to customize your WordPress site with your desired functionality. Since so much functionality is provided through plugins, WordPress core is full-featured and customizable, without having to include everything for everyone.
Some of the more popular plugins in the WordPress Plugin Directory fall into these categories:
This is just a small sample. There are thousands of plugins available in the directory, so there’s a good chance you’ll find some that are useful to you.
You can browse and search for plugins in the WordPress Plugin Directory. Each plugin listed there is available for download as a zip file you can upload to your WordPress site.
An alternative way to find and install plugins is from within the WordPress admin screens. Navigate to Plugins > Add New, and you can browse and search for plugins from within your dashboard.
Each plugin listed there has an “Install Now” button so you can easily add it to your site.
If a plugin hasn’t been updated since the most recent update to WordPress core, it may be incompatible, or its compatibility may be unknown. You can view compatibility information about plugins from the Add Plugins page, or from the Installed Plugins list.
To learn about the compatibility of a plugin before you install it, navigate to Plugins > Add New. Each plugin description on this page includes a note that reads “Compatible with your version of WordPress” or “Untested with your version of WordPress.” You can click the “More Details” link to see information about this plugin’s compatibility.
To learn about the compatibility of plugins you’ve already installed, click the “Plugins” link in the left nav of your site’s dashboard. Each item on this list should contain a “View details” link. Click this to see information about this plugin’s compatibility with different versions of WordPress.
There are 3 ways to install WordPress plugins.
Automatic Plugin Installation. Any plugin available in the WordPress Plugins Directory can be installed via the built-in plugin installer.
Upload via WordPress Admin. You can easily add a new plugin by uploading a zip archive of the plugin from your local computer.
Manual Plugin Installation. In some cases, you may need to manually upload a plugin directly using an SFTP client.
This is the simplest method of installing a plugin. To add a plugin using the built-in plugin installer:
If you have a copy of the plugin as a zip file, you can manually upload it and install it through the Plugins admin screen.
In rare cases, you may need to install a plugin by manually transferring the files onto the server. This is recommended only when absolutely necessary, for example when your server is not configured to allow automatic installations.
This procedure requires you to be familiar with the process of transferring files using an SFTP client. It is recommended for advanced users and developers.
Here are the detailed instructions to manually install a WordPress plugin by transferring the files onto the webserver.
You can add a plugin to your list of favorites, and you can view and easily install another WordPress.org user’s favorite plugins.
To see a WordPress.org user’s favorite plugins (including your own):
Plugin developers update their plugins occasionally by adding new features, improving code quality, and keeping them secure. To ensure that these changes are applied on your site immediately, you should keep your WordPress plugins up to date. This helps to improve your site’s WordPress security and performance.
Your WordPress Dashboard automatically notifies you when a plugin needs to be updated — you can view this notification under the Dashboard->Updates tab.
NOTE: Always make sure you have a current backup of your site before updating your plugins. Sometimes problems can happen during the update process.
You can find the plugins that need to be updated on your site’s Plugins page.
To find any plugins installed on your site that need to be updated:
NOTE: Always make sure you have a current backup of your site before updating your plugins. Sometimes problems can happen during the update process.
WordPress introduced automatic updates for WordPress plugins in WordPress 5.5. This allows you to enable automatic updates for individual WordPress plugins directly from the Plugins Page in the WordPress dashboard.
To stop your plugins from updating automatically, do the following:
If you have several plugins on your website that need an update, then you can bulk update those plugins. It is always recommended to do a quick review of all the plugins before updating.
If all goes well with the updates, you will see a message saying that the updates were completed successfully.
Plugins have a safe and easy-to-use uninstaller. If that is not available, you can also manually uninstall the plugins.
The safe and easy way to uninstall a plugin is via the WordPress admin screen.
Occasionally, a WordPress Plugin may not work as expected. This section provides helpful resources and steps you can take for troubleshooting plugin issues.
NOTE: If you have access to the plugin files, you can also find this information in the Plugin’s folder inside readme.txt.
Sometimes problems may be caused by a conflict with different WordPress plugins. There are a few different ways you can tell which plugin is causing the issue.
Plugins are managed from the Plugins admin screen of your WordPress site.
Here you will find a list of all installed plugins, whether they are active or inactive. From this screen, you can activate, deactivate and delete plugins.
Plugins listed in bold are currently active.
Each plugin on the list also contains links to further information about the plugin.
Must-use plugins (a.k.a. mu-plugins) are plugins installed in a special directory inside the content folder and which are automatically enabled.
Must-use plugins do not show in the default list of plugins on the Plugins page and cannot be disabled except by removing the plugin file from the must-use directory, which is found in wp-content/mu-plugins by default.
For more details, please refer Must Use Plugins.
The WordPress community relies on plugin developers to maintain a healthy and growing collection of plugins. A large part of what makes WordPress valuable is the extensive and freely available plugins.
You can help WordPress users by creating your own plugins for distribution through the WordPress plugin directory.
You can get started with the WordPress plugin development using the resources in the WordPress Plugin Developer Handbook.
]]>This page talks about Files only; if you need to back up your WordPress database, see the Backing Up Your Database.
Your WordPress site consists of the following files:
Everything that has anything to do with the look and feel of your site is in a file somewhere and needs to be backed up. Additionally, you must back up all of your files in your WordPress directory (including subdirectories) and your .htaccess
file.
While most hosts back up the entire server, including your site, it is better that you back up your own files. The easiest method is to use an FTP program to download all of your WordPress files from your host to your local computer.
By default, the files in the directory called wp-content are your own user-generated content, such as edited themes, new plugins, and uploaded files. Pay particular attention to backing up this area, along with your wp-config.php
, which contains your connection details.
The remaining files are mostly the WordPress Core files, which are supplied by the WordPress download zip file.
Please read Backing Up Your WordPress Site for further information.
Other ways to backup your files include:
Website Host Provided Backup Software
Most website hosts provide software to back up your site. Check with your host to find out what services and programs they provide.
Create Synchs With Your Site
WinSCP and other programs allow you to synchronize with your website to keep a mirror copy of the content on your server and hard drive updated. It saves time and makes sure you have the latest files in both places.
Copy Your Files to Your Desktop
Using FTP Clients or UNIX Shell Skills you can copy the files to a folder on your computer. Once there, you can zip or compress them into a zip file to save space, allowing you to keep several versions.
Normally, there would be no need to copy the WordPress core files, as you can replace them from a fresh download of the WordPress zip file. The important files to back up would be your wp-config.php file, which contains your settings and your wp-content directory (plus its contents) which contains all your theme and plugin files
The Template Editor is only available if your site is using a block theme or a classic theme that has enabled the Template Editor on the backend.
WordPress uses templates to create the layout and structure for posts, pages, or specific page types on your site page. There are a few base templates that are generated when you select a theme. For example:
In addition, your block theme may come bundled with custom templates.
In the Template Editor, you can find all the templates on your site, including any custom templates you created and the ones that came bundled with your theme. You can edit these templates and create custom layouts using blocks.
When you make changes to a template, the editor updates the blocks on all pages/posts that use the template. These changes take precedence over your theme’s bundled template files.
To work with the Template Editor, you need to use a block theme on your site. A block theme is a theme that uses blocks for all parts of a site, including navigation menus, header, content, and site footer.
All blocks that are available in the WordPress Block editor can be used in the Template Editor. To find block themes, from the WordPress dashboard, go to Appearance > Themes and click Add New. In the Add Themes page, select Block Themes to find the growing list of Block themes in the WordPress theme directory.
Once you install and activate a Block theme on your site, go to Appearance > Editor (beta) to open the Site Editor.
There are two different ways you can access the Template Editor depending on what type of theme you are using:
To use the Template Editor via the WordPress Block Editor, make sure your site is using a block theme or a classic theme that has enabled the Template Editor on the backend.
The Edit option is only available if you are using a block theme that lets you edit custom templates.
When you make changes to a template, the editor updates the blocks on all pages/posts that use the template
This option is only available if you are using a block theme that lets you create custom templates.
When you make changes to a template, the editor updates the blocks on all pages/posts that use the template.
The Template Editor displays the templates that you can add to your site.
If you already added a template from the Template Editor (for eg: Category), it will not display that template name (in this case, Category) in the drop-down menu, when you click Add New.
Once you select the template to add, you are taken to the Template Editor pre-populated with content. This means you would be presented with content already in the template rather than starting from scratch. You can design the layout further by adding or removing blocks from the template.
To create a custom page template, select Page from the drop-down menu after you click on the Add New button in the Template Editor.
A new dialog will appear listing all the pages on your site. If your site has more than 10 Pages, the dialog box will also show a Search box and you can search by the Page name to find the one you are looking for.
You can select a specific page to apply the template. Once you select the page, you are taken to the Template Editor where you can design the layout of the template.
Author, Category, and Single item: Post allows you to create a single template for all the post types or a specific template for a certain post type. This is helpful for example, if you want to show a grid of posts for a specific “photography” category but not change the default list style for others.
To create a custom category template, select Category from the drop-down menu, after you click on the Add New button in the Template Editor. A new dialog will appear with two choices:
All Categories – for creating the default category template. This is used as a fallback when a more specific category template does not exist.
Category – for creating a custom template for an individual category. Selecting this option will open a new dialog listing all the categories on your site. . If your site has more than 10 Categories, the dialog box will also show a Search box and you can search by the Category name to find the one you are looking for.
Once you make your choice between All Categories or Categories you will be taken to the Template Editor, where you can design the layout of the template.
To create a custom author template, select Author from the drop-down menu, after you click on the Add New button in the Template Editor. This will open up a dialog where you can choose between creating one template for all the authors (All Authors) or a specific template for a certain author(Author). If you choose a specific template for an author, you will be prompted to choose from the list of authors on your site.
To create a post-specific template, select Single item:Post from the drop-down menu after you click on the Add New button in the Template Editor. This will open up a dialog where you can choose between creating one template for all the Posts(All Posts) or a specific template for a certain Post(Post). If you choose a specific template for a Post, you will be prompted to choose from the list of Posts on your site.
Archive and Single item: If your site has Custom Post Types, like testimonials, movies, books, or recipes, you will also be able to create a separate template for their archive pages or single posts.
For eg: to create a custom archive template for a specific custom post type eg: Works, select Archive: Works from the drop-down menu, after you click on the Add New button in the Template Editor. This will open the Template Editor pre-populated with the content of the Custom Post Type. This means you would be presented with content already in the template rather than starting from scratch. You can design the layout further by adding or removing blocks from the template.
To create a single template for a single item in the Custom Post Type eg: Works, select Single item:Works from the drop-down menu, after you click on the Add New button in the Template Editor. A new dialog will appear with two choices:
All Works: for creating the default single template for all single items in the Custom Post Type. This is used as a fallback when a more specific single template for that custom post type does not exist.
Works: for creating a single template for an individual item in the Custom Post Type (in this example Works). Selecting this option will open a new dialog listing all the items on your site for that Custom Post Type (in this example Works). Once you make your choice between All or Single Item for the Custom Post Type you will be taken to the Template Editor, where you can design the layout of the template.
A custom template can be assigned to any post, page, or custom post type.
When you add a new template from the list of choices provided in the Template Editor, they are automatically assigned to their respective page, post, or post type. For eg: The Author template gets automatically assigned to posts based on authors. When you create a new custom template, it is not assigned to anything specific until you assign a template to the post or page.
From the Template Editor, click Add New button in the top right corner and select Custom template.
In the dialog that appears, give a name for the new custom template and click Create. Make sure the name describes the template eg: Post with sidebar.
You will be taken to the Template Editor pre-populated with content and you can design the layout of the template further by adding or removing blocks.
Changing a page’s template affects that page only (not your entire site.)
You can only rename a custom template that you created. This means the default templates in WordPress and custom templates that came bundled with your theme cannot be renamed.
There are two ways you can rename custom templates:
When changes are made to templates that came bundled with your block theme, you will see the option to clear customizations.
An easy way to identify the templates you have customized is to look for the blue dot next to the template icon in the Added by column, in the list of templates.
Hovering over the blue template will also show a tooltip that indicates the template has been customized.
This feature is only available for the templates that you have already customized. If you don’t find this option, it means your template is already in its default state.
There are three ways you can clear customizations:
You can only delete the custom templates that you created.
Changelog:
phpMyAdmin is a program used to manipulate databases remotely through a web interface. A good hosting package will have this included. For information on backing up your WordPress database, see Backing Up Your Database.
Information here has been tested using phpMyAdmin 4.0.5 running on Unix.
The following instructions will replace your current database with the backup, reverting your database to the state it was in when you backed up.
Using phpMyAdmin, follow the steps below to restore a MySQL/MariaDB database.
Now grab a coffee. This bit takes a while. Eventually you will see a success screen.
If you get an error message, your best bet is to post to the WordPress support forums to get help.
The restore process consists of unarchiving your archived database dump, and importing it into your MySQL/MariaDB database.
Assuming your backup is a .bz2
file, created using instructions similar to those given for Backing up your database using MySQL/MariaDB commands, the following steps will guide you through restoring your database:
.bz2
file:user@linux:~/files/blog> bzip2 -d blog.bak.sql.bz2
Note: If your database backup was a .tar.gz
file called blog.bak.sql.tar.gz
, then
tar -zxvf blog.bak.sql.tar.gz
is the command that should be used instead of the above.
user@linux:~/files/blog> mysql -h mysqlhostserver -u mysqlusername -p databasename < blog.bak.sql]]>
Enter password: (enter your mysql password)
user@linux:~/files/blog>
[ audio]
Note: Do not put space between “[” and “audio”.
You can also use build-in embeds and simply put the media file on its own line:
My cool content
http://my.mp3s.com/cool/songs/coolest.mp3
More cool content
I have an old post that has an audio file in the Media Library attached to it, and I want to use the new shortcode:
[ audio]
Note: Do Not put Space between “[” and “audio”.
I have the URL for an MP3, from the Media Library or external, that I want to play:
[audio src="audio-source.mp3"]
I have a source URL and fallbacks for other HTML5-supported filetypes:
[audio mp3="source.mp3" ogg="source.ogg" wav="source.wav"]
The following basic options are supported:
src
(string) (optional) The source of your audio file. If not included it will auto-populate with the first audio file attached to the post. You can use the following options to define specific filetypes, allowing for graceful fallbacks:
Default: First audio file attached to the post
loop
(string) (optional) Allows for the looping of media.
Default: “off”
autoplay
(string) (optional) Causes the media to automatically play as soon as the media file is ready.
Default: “off”
preload
(string) (optional) Specifies if and how the audio should be loaded when the page loads. Defaults to “none”
Default: “none”
WordPress Shortcodes: video, caption, embed, gallery, playlist
If you are moving WordPress from one server to another, begin by backing up your WordPress directory, images, plugins, and other files on your site as well as the database. See WordPress Backups and Backing Up Your Database.
Moving your domain without changing the Home and Site URLs of your WordPress site is very simple, and in most cases can be done by moving the files.
Moving a website and changing your domain name or URLs (i.e. from http://example.com/site to http://example.com, or http://example.com to http://example.net) requires the following steps – in sequence.
When your domain name or URLs change there are additional concerns. The files and database can be moved, however references to the old domain name or location will remain in the database, and that can cause issues with links or theme display.
If you do a search and replace on your entire database to change the URLs, you can cause issues with data serialization, due to the fact that some themes and widgets store values with the length of your URL marked. When this changes, things break. To avoid that serialization issue, you have three options:
Note: Only perform a search and replace on the wp_posts table.
Note: Search and Replace from Interconnectit is a 3rd party script
Moving the WordPress files from one location on your server to another – i.e. changing its URL – requires some special care. If you want to move WordPress to its own folder, but have it run from the root of your domain, please read Giving WordPress Its Own Directory for detailed instructions.
Here are the step-by-step instructions to move your WordPress site to a new location on the same server:
It is important that you set the URI locations BEFORE you move the files.
If you accidentally moved the files before you changed the URIs: you have two options.
/path/to/old/
and you moved them to /path/to/new
before changing the URIs. The way to fix this would be to make /path/to/old/
a symlink (for Windows users, “symlink” is equivalent to “shortcut”) to /path/to/new/
, i.e. ln -s /path/to/new /path/to/old
wp_options
table. This table stores all the options that you can set in the interface. The WordPress Address and Blog Address are stored as siteurl
and home
(the option_name field). All you have to do is change the option_value field to the correct URL for the records with option_name=’siteurl‘ or option_name=’home‘
.Note: Sometimes, the WordPress Address and Blog Address are stored in WordPress Transients. Search and replace scripts can have trouble modifying those to the new address and some plugins might therefore refer to the old address because of them. Transients are temporary (cached) values stored in the wp_options
database table that can be recreated on-demand when removed. It’s therefore safe to delete them from the migrated database copy and let them be recreated. This database query (again, have a backup!) clears all transients:
DELETE FROM `wp_options` WHERE option_name LIKE '%\_transient\_%'
Suppose you accidentally changed the URIs where you cannot move the files (but can still access the login page, through a redirection or something).
wp-login.php can be used to (re-)set the URIs. Find this line:
require( dirname(__FILE__) . '/wp-load.php' );
and insert the following lines below:
//FIXME: do comment/remove these hack lines. (once the database is updated)
update_option('siteurl', 'http://your.domain.name/the/path' );
update_option('home', 'http://your.domain.name/the/path' );
You’re done. Test your site to make sure that it works right. If the change involves a new address for your site, make sure you let people know the new address, and consider adding some redirection instructions in your .htaccess file to guide visitors to the new location.
Changing The Site URL also provides the details of this process.
Caution: Make sure you have a backup of your old site’s WordPress database before proceeding!
Part A – Activating Your New Site
Part B – Restoring Your Old Site
Another procedure for making copies of posts, comments, pages, categories and custom field (post status, data, permalinks, ping status, etc.) easy to follow:
Note: using this method, if there are some articles in the new site (like Hello World, Info Page, etc.), these will not be erased. Articles are only added. Using the former procedure, the articles in new site will be deleted.
Multisite is somewhat more complicated to move, as the database itself has multiple references to the server name as well as the folder locations. If you’re simply moving to a new server with the same domain name, you can copy the files and database over, exactly as you would a traditional install.
If, instead, you are changing domains, then the best way to move Multisite is to move the files, edit the .htaccess and wp-config.php (if the folder name containing Multisite changed), and then manually edit the database. Search for all instances of your domain name, and change them as needed. This step cannot yet be easily automated. It’s safe to search/replace any of the wp_x_posts tables, however do not attempt blanket search/replace without the Search and Replace for WordPress Databases script (aka the interconnectit script).
If you’re moving Multisite from one folder to another, you will need to make sure you edit the wp_blogs entries to change the folder name correctly. You should manually review both wp_site and wp_blogs regardless, to ensure all sites were changed correctly.
Also, manually review all the wp_x_options tables and look for three fields and edit them as needed:
If you are moving from subdomains to subfolders, or vice-versa, remember to adjust the .htaccess file and the value for SUBDOMAIN_INSTALL in your wp-config.php file accordingly.
wp-config.php
file. This file is located in the root of your WordPress file directory and contains your website’s base configuration details, such as database connection information.
When you first download WordPress, the wp-config.php
file isn’t included. The WordPress setup process will create a wp-config.php
file for you based on the information you provide in the installation process.
It is unlikely that a non-developer would have to edit the wp-config.php file, in the case you are acting on trouble shooting steps provided by a technical person or by your webhost, this page should help.
]]>