Advanced Topics – WordPress.org Forums https://wordpress.org/support Mon, 14 Nov 2022 20:47:35 +0000 en-US hourly 1 https://wordpress.org/?v=6.2-alpha-54954 https://s.w.org/favicon.ico?2 Advanced Topics – WordPress.org Forums https://wordpress.org/support 32 32 151909983 Installing Multiple WordPress Instances https://wordpress.org/support/article/installing-multiple-blogs/ https://wordpress.org/support/article/installing-multiple-blogs/#comments Fri, 12 Oct 2018 21:58:57 +0000 https://wordpress.org/support/?post_type=helphub_article&p=10776275 If you need multiple WordPress instances, there are three types of installations based on system architecture, or a combination of WordPress instances and databases:

  1. WordPress Multisite feature: a single WordPress instance (with multiple sites created within the same WP instance) sharing a single database instance.
  2. Single Database: multiple WordPress instances sharing a single database instance.
  3. Multiple Databases: multiple WordPress instances with each instance using its own databases instance.

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.

Multiple WordPress Instances with Multiple Databases

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.

The Multisite Feature

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:

Multiple WordPress Instances with a Single Database

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.

Multiple Databases, Same Users

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.

]]>
https://wordpress.org/support/article/installing-multiple-blogs/feed/ 4 10776275
Changing The Site URL https://wordpress.org/support/article/changing-the-site-url/ https://wordpress.org/support/article/changing-the-site-url/#comments Fri, 02 Nov 2018 03:48:31 +0000 https://wordpress.org/support/?post_type=helphub_article&p=10840035 On the Settings -> General screen in a single site installation of WordPress, there are two fields named “WordPress Address (URL)” and “Site Address (URL)”. They are important settings, since they control where WordPress is located. These settings control the display of the URL in the admin section of your page, as well as the front end, and are used throughout the WordPress code.

  • The “Site Address (URL)” setting is the address you want people to type in their browser to reach your WordPress blog.
  • The “WordPress Address (URL)” setting is the address where your WordPress core files reside.

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.

Changing the Site URL

There are four easy methods to change the Site URL manually. Any of these methods will work and perform much the same function.

Edit wp-config.php

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.

Edit functions.php

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.

  1. FTP to the site, and get a copy of the active theme’s functions.php file. You’re going to edit it in a simple text editor and upload it back to the site.
  2. Add these two lines to the file, immediately after the initial “<?php” line:
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.

LAN-based site to externally accessible site

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. 

Relocate method

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.

Code function

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 );
}

Steps

  1. Edit the wp-config.php file.
  2. After the “define” statements (just before the comment line that says “That’s all, stop editing!”), insert a new line, and type: define('RELOCATE',true);
  3. Save your wp-config.php file.
  4. Open a web browser and manually point it to 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.
  5. Login as per normal.
  6. Look in your web browser’s address bar to verify that you have, indeed, logged in to the correct server. If this is the case, then in the Admin back-end, navigate to Settings > General and verify that both the address settings are correct. Remember to Save Changes.
  7. Once this has been fixed, edit 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. 

Changing the URL directly in the database

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.

  1. Backup your database and save the copy off-site.
  2. Login to phpMyAdmin.
  3. Click the link to your Databases.
  4. A list of your databases will appear. Choose the one that is your WordPress database.
  5. All the tables in your database will appear on the screen.
  6. From the list, look for wp_options. Note: The table prefix of wp_ may be different if you changed it when installing.
  7. Click on the small icon indicated as Browse.
  8. A screen will open with a list of the fields within the wp_options table.
  9. Under the field option_name, scroll down and look for siteurl.
  10. Click the Edit Field icon which usually is found at the far left at the beginning of the row.
  11. The Edit Field window will appear.
  12. In the input box for option_value, carefully change the URL information to the new address.
  13. Verify this is correct and click Go to save the information.
  14. You should be returned to your wp_options table.
  15. Look for the 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.
  16. In the input box for option_value, carefully change the URL information to the new address.
  17. Verify this is correct and click Go to save the information.

Moving Sites

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. 

Altering Table Prefixes

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_' );

Changing Template Files

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. 

Changing the Config file

You will need to update your WordPress configuration file if your database has moved or changed in certain ways.

  1. You will only need to modify the config file if:
    1. your database has moved to another server and is not running on your localhost
    2. you have renamed your database
    3. you have changed the database user name
  2. Make a backup copy of your wp-config.php file.
  3. Open the wp-config.php file in a text editor.
  4. Review its contents. In particular, you are looking for the database host entry.
  5. Save the file.

At this point, your WordPress blog should be working.  

Verify the Profile

  1. In your Administration > Settings > General panel, you will verify that the changes you made in Changing the URL above, are correct.
  2. Verify that the reference in your WordPress Address (URL) contains the new address.
  3. Verify that the reference in your Site Address (URL) contains the new address.
  4. If you have made changes, click Save Changes.

Changing the .htaccess file

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. 

  1. Make a backup copy of your .htaccess file. This is not a recommendation but a requirement.
  2. Open the .htaccess file in a text editor.
  3. Review its contents, looking for any custom rewrites or redirects you entered. Copy these to another text file for safe keeping.
  4. Close the file.
  5. Follow the instructions on the Permalinks SubPanel for updating your Permalinks to the .htaccess file.
  6. Open the new .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.
  7. Make any changes necessary in those custom rewrites and redirects to reflect the new site address.
  8. Save the file.
  9. Test those redirects to ensure they are working.

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.

Additional items of note

There are other things you may wish to change in order to correct URLs when moving sites.

  1. Images link: image links are stored in “post_content” in the wp_posts table. You can use the similar code above to update image links.
  2. wp_options: Besides the “siteurl” and “home” items mentioned above, there are other option_value which also need revision, such as “upload path”, and some plugin items (depends on what you’ve installed, such as widgets, stats, DMSGuestbook, sitemap, etc.)
  3. To fix widgets that contain outdated URL’s, you may edit them in Dashboard / Appearance / Widgets.
  4. Do a FULL database search for any items left. MAKE SURE you know what you are changing. and go through each item for possible improper replacement.
  5. If you a running a network / have multiple sites, you will need to replace instances of the URL in the database. They are stored in many tables, including each one of the sites (blogs). Be careful in what you replace and be sure you know the meaning of the field before changing it. See the Important GUID note below for an example of what not to change.
  6. Note, if you find your old url in the database options table under ‘dashboard_incoming_links’, you can ignore or delete that option. It’s unused since WP 3.8.

Using the Export/Import feature to move a blog to a new domain. 

Important GUID Note

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');

Multi-site notes

See Moving WordPress Multisite

wp-cli

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'
]]>
https://wordpress.org/support/article/changing-the-site-url/feed/ 8 10840035
WordPress vs WordPress.com https://wordpress.org/support/article/wordpress-vs-wordpress-com/ https://wordpress.org/support/article/wordpress-vs-wordpress-com/#comments Sun, 09 Dec 2018 19:51:12 +0000 https://wordpress.org/support/?post_type=helphub_article&p=10966005 WordPress vs. WordPress.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

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

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.

Overlap

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.

Additional resource

This video is an overview of the differences between WordPress and WordPress.com:

See more here: https://learn.wordpress.org/workshop/what-is-the-difference-between-wordpress-org-and-com/

FAQ

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.

]]>
https://wordpress.org/support/article/wordpress-vs-wordpress-com/feed/ 1 10966005
Managing Plugins https://wordpress.org/support/article/managing-plugins/ https://wordpress.org/support/article/managing-plugins/#comments Wed, 24 Oct 2018 23:14:50 +0000 https://wordpress.org/support/?post_type=helphub_article&p=10813406 What are plugins?

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.

How do they relate to WordPress core?

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.

What are some examples?

Some of the more popular plugins in the WordPress Plugin Directory fall into these categories:

  • Spam control
  • SEO
  • Data import and export
  • E-commerce
  • Security
  • Caching

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.

Finding and Installing Plugins

Finding Plugins

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.

Plugin Compatibility

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.

Compatibility of New Plugins

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.

Compatibility of Installed Plugins

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.

Installing Plugins

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.

Automatic Plugin Installation

This is the simplest method of installing a plugin. To add a plugin using the built-in plugin installer:

  1. Navigate to Plugins > Add New.
  1. Use the search form in the top-right to search by keyword, author, or tag.
  1. On the search results that appear, click a plugin’s title or the link ‘More Details’ to read more about it, including installation notes, plugin documentation, or other useful information.
  2. Click the Install Now button to install the plugin.
  3. Once the plugin installation is complete, click Activate to activate the plugin.

Upload via WordPress Admin

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.

  1. Navigate to Plugins > Add New.
  2. Click the Upload Plugin button at the top of the screen.
  1. Select the zip file from your local filesystem.
  1. Click the Install Now button.
  1. When the installation is complete, you’ll see “Plugin installed successfully.” Click the Activate Plugin button.

Manual Plugin Installation

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. 

Plugin Favorites

You can add a plugin to your list of favorites, and you can view and easily install another WordPress.org user’s favorite plugins.

Favorite a Plugin

  1. Log in to the WordPress Plugins Directory using your WordPress.org ID.
  2. Find the plugin you want to like and go to the plugin’s page.
  3. Click the heart icon next to the Download button.
  1. Once you have favorited a plugin, it will show up in your WordPress.org public profile. If you have published a review of the plugin, your rating of the plugin will also appear here.

View a User’s Favorite Plugins

To see a WordPress.org user’s favorite plugins (including your own):

  1. Browse to the Add Plugins admin screen (Plugins > Add New).
  2. Click the Favorites tab.
  1. Type the user’s name in the “Your WordPress.org username” field.
  1. Click Get Favorites.
  2. Each of the plugins listed here has an ‘Install Now’ button that you can use to add the plugin to your site.

Updating Plugins

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.

Manual Plugin Update From The Dashboard

Your WordPress Dashboard automatically notifies you when a plugin needs to be updated — you can view this notification under the Dashboard->Updates tab. 

  1. Scroll down to the Plugins section.
  1. Select the checkbox for the plugins you want to update and then click  ‘Update Plugins’ button.

NOTE: Always make sure you have a current backup of your site before updating your plugins. Sometimes problems can happen during the update process.

Manual Plugin Update From The Plugins Page

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:

  1. Click the “Plugins” link in the left nav of your site’s dashboard.
  2. Look down the list of installed plugins for any that include a line reading “There is a new version…”
  3. Click the “View version…” link in that note to view details about the plugin’s update.
  4. Click the “update now” link to update the plugin.

NOTE: Always make sure you have a current backup of your site before updating your plugins. Sometimes problems can happen during the update process.

Enable Automatic Plugin Update

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.

  1. Go to Plugins -> Installed Plugins page inside WordPres Admin area. Here you’ll see the list of all your installed plugins.  Each plugin in the list has a link ‘Enable auto-updates’ in the right-most column (under Automatic Updates).
  2. Select the checkbox for the plugins you want to enable auto-update and click the link  ‘Enable auto-updates’ for the selected plugin. This will enable automatic updates for the selected plugin.

 Disable Automatic Plugin Update

  To stop your plugins from updating automatically, do the following:

  1. Go to Plugins -> Installed Plugins page inside WordPres Admin area. Here you’ll see the list of all your installed plugins.  
  2. Each plugin in the list that has auto-update enabled will have a link ‘Disable auto-updates’ in the right-most column (under Automatic Updates).
  3. Select the checkbox for the plugin you want to disable auto-update and click the link  Disable auto-updates’ for the selected plugin. This will disable automatic updates for the selected plugin.

Bulk Update WordPress Plugins

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.

  1. Go to the Plugins page and click on the ‘Update Available’ link. This will show you the list of all plugins that have updates available.
  1. Click the checkbox to select all the plugins you want to update.
  1. From the ‘Bulk Actions’ drop down, select ‘Update’ and click ‘Apply’.

If all goes well with the updates, you will see a message saying that the updates were completed successfully.

Uninstalling Plugins

Plugins have a safe and easy-to-use uninstaller. If that is not available, you can also manually uninstall the plugins.

Automatic Uninstallation

The safe and easy way to uninstall a plugin is via the WordPress admin screen.

  1. Navigate to your Plugins admin screen and locate the plugin to be uninstalled.
  2. Select the checkbox next to the plugin name and click the “Deactivate” link.
  1. Once the plugin is successfully deactivated, click the plugin’s “Delete” link.

Troubleshooting

Occasionally, a WordPress Plugin may not work as expected. This section provides helpful resources and steps you can take for troubleshooting plugin issues.

Resources To Help Diagnose The Issue

  • Review the plugin’s documentation to confirm that you’ve followed the instructions. You can find this information in the Plugins page under the name of each Plugin > View details.

NOTE: If you have access to the plugin files, you can also find this information in the Plugin’s folder inside readme.txt.

  • Search the WordPress Support Forums for the name of the Plugin and keywords associated with the problem you are experiencing or the specific error message that is displayed.
  • Search the WordPress Plugins Directory for the name of the Plugin. On the Plugins page, select the Support tab to read about issues reported in the Support Forums for that plugin.
  • Go to the website of the plugin author and check their blog and Plugin page for known issues or advice.
  • Search the web with the name of the Plugin and keywords associated with the problem you are experiencing or the specific error message that is displayed.
  • Post a question in the WordPress Support Forums with the name of the Plugin and keywords associated with the problem you are experiencing or the specific error message that is displayed. Make sure to include the problem in the title of the question. For advice on how to improve your chances of getting help, see Finding WordPress Help.

Possible Resolutions

Make sure that the plugin is activated after it is installed. 

  1. Go to the Plugins > Installed Plugins from the WordPress admin screen.
  2. Find the Plugin and click ‘Activate’.

If you know which plugin is causing the issue: 

  1. Deactivate that plugin and activate it again to see if this helps.
  1. In some cases, the plugin may be buggy or incompatible. Deactivate the plugin. Search for other similar plugins, install and activate it and see it this revolves the issue.

If you don’t know which plugin is causing the issue: 

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.

  • You installed a single plugin and experienced issues with your site soon after that.
  • You updated a single plugin and experienced issues with your site soon after that.
  • There’s an error message telling you exactly which plugin file is causing the issue. 
  • Try deactivating plugins one at a time until you find the one that’s causing the issue. 
  • Once you find the plugin that is causing the issue, you can either deactivate and activate it again to see if this helps. Or you can find other similar plugins from the WordPress Plugins Directory, install and activate it and see if this resolves the issue. 

Plugin Management

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

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.

Developing 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.

]]>
https://wordpress.org/support/article/managing-plugins/feed/ 13 10813406
Backing Up Your WordPress Files https://wordpress.org/support/article/backing-up-your-wordpress-files/ https://wordpress.org/support/article/backing-up-your-wordpress-files/#respond Fri, 02 Nov 2018 04:06:26 +0000 https://wordpress.org/support/?post_type=helphub_article&p=10840075 There are two parts to backing up your WordPress site: Database and Files.

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:

  • WordPress Core Installation
  • WordPress Plugins
  • WordPress Themes
  • Images and Files
  • Javascripts, PHP scripts, and other code files
  • Additional Files and Static Web Pages

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.

Synchronize your files in WinScp

  1. Log in to your ftp server normally using WinScp.
  2. Press the “Synchronize” button. Remote directory will automatically be set to the current ftp directory (often your root directory). Local directory would be set to the local directory as it was when you pressed Synchronize. You may want to change this to some other directory on your computer. Direction should be set to “local” to copy files FROM your web host TO your machine. Synchronization Mode would be set to Synchronize files.
  3. Click “OK” to show a summary of actions.
  4. Click “OK” again to complete the synchronization.

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

Read Further

WordPress Backups
Upgrading WordPress Extended

]]>
https://wordpress.org/support/article/backing-up-your-wordpress-files/feed/ 0 10840075
Template Editor https://wordpress.org/support/article/template-editor/ https://wordpress.org/support/article/template-editor/#comments Thu, 08 Jul 2021 20:04:21 +0000 https://wordpress.org/support/?post_type=helphub_article&p=14632189 The Template Editor allows you to edit and create templates, using blocks. These templates control the layout of the posts, pages, or page types on your site.

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.

About Templates

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:

  • The Home template is used to display the site’s home page if your site is set up to display the latest posts on the home page.
  • The Index template is used to display the index page of all the blog posts.
  • The Page template is used to display the site’s pages if no specific templates are assigned to the page.
  • Many block themes offer other built-in templates like the Single Post template to customize the layout of single blog posts, the 404 template to customize the layout of the 404 error page, the Search template to customize the layout of the search results page, and the Archive template for categories/archives page, etc.

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.

What you need, to use the Template Editor

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.

How to find a block theme
How to find a block theme

Once you install and activate a Block theme on your site, go to Appearance > Editor (beta) to open the Site Editor.

Two ways to access the Template Editor

There are two different ways you can access the Template Editor depending on what type of theme you are using:

  • If you are using a block theme, you can access the Template Editor when editing posts or pages via the WordPress Block Editor and also via the Site Editor.
  • If you are using a classic theme that has enabled the Template Editor on the backend, you can access the Template Editor only when editing posts or pages via the WordPress Block Editor.

How to use the Template Editor via the WordPress Block Editor

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.

To edit a template

  1. Click Posts > Add New to add a new post or Pages > Add New to add a new page.
  2. This opens the WordPress Block Editor.
  3. Navigate to the Post/Page Settings sidebar tab.
  4. Under the Summary section, click the name of the template. A popup will appear. Click Edit template.
How to edit template
How to edit template

The Edit option is only available if you are using a block theme that lets you edit custom templates.

  1. This opens the Template Editor and takes you to the template editing mode where you can make changes to the selected template. To go back to the WordPress Block Editor and continue making content changes, click the Back link at the top left corner.
Back link in the Template Editor
Back link in the Template Editor
  1. When you’re done making changes, select Publish. This will prompt you to save all the changes you made including the template and the post or page.
  2. Click Save to confirm the changes.

When you make changes to a template, the editor updates the blocks on all pages/posts that use the template

To create a new custom template

  1. Click Posts > Add New to add a new post or Pages > Add New to add a new page.
  2. This opens the WordPress Block Editor.
  3. Navigate to the Post/Page Settings sidebar tab.
  4. Under the Summary section, click the name of the template. A popup will appear. Click the add template icon in the top right corner.
How to add a new template
How to add a new template

This option is only available if you are using a block theme that lets you create custom templates.

  1. This opens a dialog box where you can give a name for the custom template you are about to create. Make sure to give it a descriptive name that describes the purpose of the template e.g. “Full Width”.
  2. Click Create to open the Template Editor and go to the template editing mode where you can build the custom template using blocks. To go back to the WordPress Block Editor and continue making content changes, click the Back link at the top left corner.
Back link in the Template Editor
  1. When you’re done making changes, select Publish. This will prompt you to save all the changes you made including the template and the post or page.
  2. Click Save to confirm the changes.

How to use the Template Editor via the Site Editor

To navigate to templates

  • Go to Appearance > Editor (beta) to open the Site Editor. You will be taken to the template of your home page (based on what you have set in the Reading Settings) and you can start editing this template.
  • To view the list of templates available for your site and switch between templates:
    • Click on the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation.
    • Click on Templates to view the list of templates.
    • Click on any template name from the list to switch to that template.

To edit a template

  • From the Site Editor (Appearance > Editor (beta) ), click on the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation.
  • Click on Templates to view the list of templates on your site, including any you have created and any that come with your theme.
  • Click on any of the templates in the list to edit the template. From here you can customize the layout of the selected template using blocks.
  • When you are done with the template customization, click Save.

When you make changes to a template, the editor updates the blocks on all pages/posts that use the template.

  • To go back to the Site Editor, click on the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation and click Site.
Going back to Site Editor from Template Editor
Going back to Site Editor from Template Editor

To add a new template

The Template Editor displays the templates that you can add to your site.

  • From the Appearance > Editor (beta), click the WordPress icon (or Site icon if you have set one) to open the Site Editor left navigation.
  • Click Templates to view the list of templates on the site.
  • Click Add New button in the top right corner to show a drop-down menu with a list of all new templates you can add to your site.
    • Front Page – to display the home page of your site if your site is set up to display a regular page for the home page.
    • Page – It allows the creation of templates that can be applied to a specific page on the site or as the default page template (if not already defined by the theme).
    • Author – It allows the creation of templates that can be applied to posts by a specific author on the site or as the default template for all authors (if not already defined by the theme).
    • Category – It allows the creation of templates that can be applied to posts by a specific category on the site or as the default template for all categories (if not already defined by the theme).
    • Date – It allows the creation of templates that can be applied to posts by date (if not already defined by the theme).
    • Tag – It allows the creation of templates that can be applied to posts by tag (if not already defined by the theme).
    • Taxonomy – It allows the creation of templates that can be applied to posts by a specific taxonomy term (if not already defined by the theme).
    • Single item: Post – It allows the creation of post-specific templates.

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.

Add new templates
Add new templates

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 add a new Page 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.

Adding a new custom Page template

To add a single template for all post types and specific post types

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:

Creating templates for Category
Creating templates for Category

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.

Creating template for a specific category
Creating template for specific category

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.

Creating templates for author
Creating templates for author
Choosing the specific author for creating the template
Choosing the specific author for creating the template

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.

Creating template for Post
Creating template for Post
Creating template for specific post
Creating template for specific post

To add an archive and single template for custom post types

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.

Adding archive template for custom post type

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:

Single template for custom post types-works

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.

Single template for custom post types-Works

To create a new custom 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.

Adding a 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.

Create custom template dialog

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.

How to assign a custom template to a post or page

  1. From the WordPress Dashboard, open the post or page that you want to assign the template.
  2. This opens the WordPress Block Editor.
  3. Navigate to the Post/Page Settings sidebar tab.
  4. Under the Summary section, click the name of the template. A popup will appear.
  5. In the popup, open the drop-down list to find the list of all custom templates. Pick the template you want to assign to the post or page.
How to assign a template to a post or page

Changing a page’s template affects that page only (not your entire site.)

How to rename custom templates

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:

From the top bar within a template

  • Click on Templates to view the list of templates on your site.
  • Click on the custom template you created, that you want to rename. This will open the template in the Template Editor.
  • In the Template Editor, click the down arrow next to the name of the Template in the top bar. This opens a drop-down menu where you can type in a new name for the custom template you selected. Make sure the name describes the template eg: Post with sidebar.
Renaming a custom template
Renaming a custom template
  • When you are done, click Save in the top bar to save the custom template with the new name.

From the templates list in the Template Editor

  • Click on Templates to view the list of templates on your site.
  • Click the three-dot menu icon next to any of the custom templates you created. From the drop-down menu and select Rename.
  • This will open a dialog box where you can type in a new name for the custom template you selected. Make sure the name describes the template eg: Post with sidebar.
  • Click Save to save the custom template with the new name.
Renaming custom template
Renaming custom template

Clear customizations to templates in your block theme

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.

The blue dot that indicates the templates you customized
The blue dot that indicates the templates you customized

Hovering over the blue template will also show a tooltip that indicates the template has been customized.

The tooltip that indicates the templates you customized
The tooltip that indicates the templates you 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:

From the top bar within a template

  • Click on Templates to view the list of templates on your site.
  • Click on the template you want to clear customizations for. This will open the template in the Template Editor.
  • In the Template Editor, click the down arrow next to the name of the Template in the top bar. This opens a drop-down menu. Click Clear customizations in the drop-down menu. You will see a message at the bottom left corner of the window Template reverted.
Clear customization in a template
Clear customization in a template
Template reverted message
Template reverted message

From the templates list in the Template Editor

  • Click on Templates to view the list of templates on your site.
  • Click the three-dot menu icon to open a drop-down menu and select Clear customizations. This will reset the template to the default state and you will lose the changes you made to that template.
Clear customizations for Template
Clear customizations for Template

From the Settings sidebar within a template

  • Click on Templates to view the list of templates on your site.
  • Click on the template you want to clear customizations for. This will open the template in the Template Editor.
  • Click the three-dot menu icon in the Template settings sidebar. This will open a drop-down menu. Select Clear customizations. This will reset the template to the default state and you will lose the changes you made to that template. You will see a message at the bottom left corner of the window Template reverted.
Clear customization from the Template settings sidebar
Clear customization from the Template settings sidebar
Template reverted message
Template reverted message

How to delete a template

You can only delete the custom templates that you created.

  • Click on Templates to view the list of templates on your site.
  • Click the three-dot menu icon on any of the custom templates you created. From the drop-down menu and select Delete. This will delete the template.
Delete a template
Delete a template

Changelog:

  • Updates 2022-10-20
    • Updated content, videos, and screenshots for 6.1
    • Updated resources section to remove external links and add links to Learn workshops and courses
  • Updated on May 22, 2022
    • Adding 6.0 features. updating screenshots and videos and reworking content.
  • Edited to add in content around the Site Editor on January 5, 2022
  • Edited to add in an additional Resource item on July 30, 2021
  • Created on July 11, 2021
]]>
https://wordpress.org/support/article/template-editor/feed/ 3 14632189
Restoring Your Database From Backup https://wordpress.org/support/article/restoring-your-database-from-backup/ https://wordpress.org/support/article/restoring-your-database-from-backup/#comments Sat, 27 Oct 2018 06:03:29 +0000 https://wordpress.org/support/?post_type=helphub_article&p=10820893 Using phpMyAdmin

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.

Restore Process

Using phpMyAdmin, follow the steps below to restore a MySQL/MariaDB database.

  1. Login to phpMyAdmin.
  2. Click “Databases” and select the database that you will be importing your data into.
  3. You will then see either a list of tables already inside that database or a screen that says no tables exist. This depends on your setup.
  4. Across the top of the screen will be a row of tabs. Click the Import tab.
  5. On the next screen will be a location of text file box, and next to that a button named Browse.
  6. Click Browse. Locate the backup file stored on your computer.
  7. Make sure SQL is selected in the Format drop-down menu.
  8. Click the Go button.

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.

Using MySQL/MariaDB Commands

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:

  1. Unzip your .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.

  1. Put the backed-up SQL back into MySQL/MariaDB:
user@linux:~/files/blog> mysql -h mysqlhostserver -u mysqlusername -p databasename < blog.bak.sql

Enter password: (enter your mysql password)
user@linux:~/files/blog>

]]>
https://wordpress.org/support/article/restoring-your-database-from-backup/feed/ 7 10820893
Audio Shortcode https://wordpress.org/support/article/audio-shortcode/ https://wordpress.org/support/article/audio-shortcode/#comments Fri, 02 Nov 2018 04:23:13 +0000 https://wordpress.org/support/?post_type=helphub_article&p=10840101 The Audio feature allows you to embed audio files and play them back using a simple Shortcode. This was added as of WordPress 3.6 and is used like this:

[ 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

Usage

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"]

Options

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:

  • ‘mp3’, ‘m4a’, ‘ogg’, ‘wav’, ‘wma’

Default: First audio file attached to the post

loop
(string) (optional) Allows for the looping of media.

  • “off” – Do not loop the media.
  • “on” – Media will loop to the beginning when finished and automatically continue playing.

Default: “off”

autoplay
(string) (optional) Causes the media to automatically play as soon as the media file is ready.

  • “off” – Do not automatically play the media.
  • “on” – Media will play as soon as it is ready.

Default: “off”

preload
(string) (optional) Specifies if and how the audio should be loaded when the page loads. Defaults to “none”

  • “none” – The audio should not be loaded when the page loads.
  • “auto” – The audio should be loaded entirely when the page loads.
  • “metadata” – Only metadata should be loaded when the page loads.

Default: “none”

Related

WordPress Shortcodes: videocaptionembedgalleryplaylist

Changelog

  • Updated 2021-10-18
    • Added changelog
    • Corrected the links to the codex pages for the caption, embed, gallery and playlist shortcodes
]]>
https://wordpress.org/support/article/audio-shortcode/feed/ 2 10840101
Moving WordPress https://wordpress.org/support/article/moving-wordpress/ https://wordpress.org/support/article/moving-wordpress/#comments Sat, 27 Oct 2018 06:28:17 +0000 https://wordpress.org/support/?post_type=helphub_article&p=10821028 Whether you are moving WordPress to a new server or to a different location on your server, you don’t need to reinstall. WordPress is flexible enough to handle all of these situations.

Moving to a New Server

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.

Keeping Your Domain Name and URLs

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.

  • If database and URL remain the same, you can move by just copying your files and database.
  • If database name or user changes, edit wp-config.php to have the correct values.
  • If you want to test before you switch, you must temporarily change “siteurl” and “home” in the database table “wp_options” (through phpMyAdmin or similar).
  • If you had any kind of rewrites (permalinks) setup you must disable .htaccess and reconfigure permalinks when it goes live.

Changing Your Domain Name and URLs

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.

  1. Download your existing site files.
  2. Export your database – go in to MySQL and export the database.
  3. Move the backed up files and database into a new folder – somewhere safe – this is your site backup.
  4. Log in to the site you want to move and go to Settings > General, then change the URLs. (ie from http://example.com/ to http://example.net ) – save the settings and expect to see a 404 page.
  5. Download your site files again.
  6. Export the database again.
  7. Edit wp-config.php with the new server’s MySQL database name, user and password.
  8. Upload the files.
  9. Import the database on the new server.

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:

  1. Use the Velvet Blues Update URLs or Better Search Replace plugins if you can access your Dashboard.
  2. Use WP-CLI’s search-replace if your hosting provider (or you) have installed WP-CLI.
  3. Use the Search and Replace for WordPress Databases Script to safely change all instances on your old domain or path to your new one. (** only use this option if you are comfortable with database administration ** )

Note: Only perform a search and replace on the wp_posts table.
Note: Search and Replace from Interconnectit is a 3rd party script

Moving Directories On Your Existing Server

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:

  1. Create the new location using one of these two options:
    1. If you will be moving your WordPress core files to a new directory, create the new directory.If you want to move WordPress to your root directory, make sure all index.php, .htaccess, and other files that might be copied over are backed up and/or moved, and that the root directory is ready for the new WordPress files.
  2. Log in to your site.
  3. Go to the Administration > Settings > General screen.
  4. In the box for WordPress Address (URL): change the address to the new location of your main WordPress core files.
  5. In the box for Site Address (URL): change the address to the new location, which should match the WordPress (your public site) address.
  6. Click Save Changes.
  7. (Do not try to open/view your site now!)
  8. Move your WordPress core files to the new location. This includes the files found within the original directory, such as http://example.com/wordpress, and all the sub-directories, to the new location.
  9. Now, try to open your site by going to yourdomain.com/wp-admin. Note, you may need to go to yourdomain.com/wp-login.php
  10. If you are using Permalinks, go to the Administration > Settings > Permalinks panel and update your Permalink structure to your .htaccess, file, which should be in the same directory as the main index.php file.
  11. Existing image/media links uploaded media will refer to the old folder and must be updated with the new location. You can do this with the Better Search Replace or Velvet Blues Update URLs plugins, WP-CLI’s search-replace if your hosting provider (or you) have installed WP-CLI, manually in your SQL database, or by using the 3rd party database updating tool Search and Replace Databases Script * Note: this script is best used by experienced developers.
  12. In some cases your permissions may have changed, depending on your ISP. Watch for any files with “0000” permissions and change them back to “0644”.
  13. If your theme supports menus, links to your home page may still have the old subdirectory embedded in them. Go to Appearance > Menus and update them.
  14. Sometimes you would need to restart your server, otherwise your server may give out an error. (happens in MAMP software (Mac)).

It is important that you set the URI locations BEFORE you move the files.

If You Forget to Change the Locations

If you accidentally moved the files before you changed the URIs: you have two options.

  1. Suppose the files were originally in /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
    and then follow the steps above as normal. Afterwards, delete the symlink if you want.
  2. If you forget to change the WordPress Address and Blog Address, you will be unable to change it using the wordpress interface. However, you can fix it if you have access to the database. Go to the database of your site and find the 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\_%' 

If You Have Accidentally Changed your WordPress Site URL

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.

Managing Your Old Site

Shutting It Down

  1. Download a copy of the main wordpress files from your OLD site to your hard drive and edit wp-config.php to suit the new server.
  2. Go back to your OLD site and go to Administration > Settings > General screen and change the URL (both of them) to that of your new site.
  3. Login on your server, go to phpMyAdmin, export as file, and save your database (but keep the old one just in case). Now, upload this new database and the copy of the wordpress core files with the edited wp-config.php to your new server. That’s it!

Keeping it Running

Caution: Make sure you have a backup of your old site’s WordPress database before proceeding!

Part A – Activating Your New Site

  1. Download your entire WordPress installation to your hard drive. Name the folder appropriately to indicate that this is your OLD site’s installation.
  2. Download your database.
  3. Go back to your OLD site and go to options and change the url (both of them) to that of your new site.
  4. Again, download your entire WordPress installation to your hard drive. Name the folder appropriately to indicate that this is your NEW site’s installation.
  5. Download your database once again (but keep the old one). Upload this database to your new server. It will be easiest if you use the same database name and you create a user with the same login credentials on your new server as on your old server.
  6. If you used a different database name and/or user (see previous step), edit wp-config.php in your NEW site’s installation folder appropriately.
  7. Upload the NEW site’s installation folder to your new site. Presto, your NEW site should be working!

Part B – Restoring Your Old Site

  1. On the original server, delete your OLD site’s database (remember, you should have a copy on your local computer that you made at the very beginning).
  2. Upload your OLD site’s installation folder to your original server, overwriting the files that are currently there (you may also delete the installation folder on the server and simply re-upload the OLD site’s files).
  3. Upload your OLD site’s database from your local computer to the server. That should do it!

Another procedure for making copies of posts, comments, pages, categories and custom field (post status, data, permalinks, ping status, etc.) easy to follow:

  1. Install a new WordPress site
  2. Go on old site Admin panel. Here, in Manage > Export select “all” in menu Restrict Author.
  3. Click on Download Export File
  4. In new site go on Manage > Import, choose WordPress item.
  5. In the page that will be shown, select the file just exported. Click on Upload file and Import
  6. It will appear a page. In Assign Authors, assign the author to users that already exist or create new ones.
  7. Click on Submit
  8. At the end, click on Have fun

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.

Moving WordPress Multisite

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:

  • home
  • siteurl
  • fileupload_url

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.

Related Links

]]>
https://wordpress.org/support/article/moving-wordpress/feed/ 7 10821028
Editing wp-config.php https://wordpress.org/support/article/editing-wp-config-php/ https://wordpress.org/support/article/editing-wp-config-php/#comments Fri, 02 Nov 2018 04:43:29 +0000 https://wordpress.org/support/?post_type=helphub_article&p=10840119 One of the most important files in your WordPress installation is the 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.

]]>
https://wordpress.org/support/article/editing-wp-config-php/feed/ 24 10840119