WordPress

Posts related to WordPress

How to Delete a WordPress Theme

Nothing is ever straight forward. This is a fact!  Naturally, this also applies to when you want to delete a WordPress Theme.

The thing is it’s actually quite simple to remove a Theme from WordPress. The problem as always is that the option seems to be hidden from everyone.

Ok, no more talk. Let’s get to business. Here’s how you delete a WordPress Theme:

  1. In WordPress select option Appearance 
  2. You then need to select option Themes
  3. Make sure the WordPress Theme you want to delete is not Active! If it is, then activate a different one by selecting the Activate option of the new Theme
  4. Hover over the WordPress Theme you wish to delete and select Theme Details
  5. You will now be seeing the Theme details page
  6. Select option Delete (right lower corner)
  7. Click OK to confirm

Congratulations! The WordPress Theme is now gone!

 

Backup and Restore a web site in CPANEL

m4s0n501

It’s a good practice to make backups prior to submit any changes to your site.

Time and again people skip the backup to find themselves with problems and not having an easy and quick way to undo their changes. This may not seem a big problem, but if the changes were done to the web site of your business and now the web site is not working probably, this means you’re losing money!

Backing up a site is easy and even more if your web server uses CPANEL.

Consider the following steps to BACKUP your site:

  • To Backup the files of your site:
    1. On CPANEL select option Backups
    2. Under Home Directory select option Download a home directory Backup
    3. Select Save File
  • To Backup the Databases of your site:
    1. On CPANEL select option Backups
    2. Under Download a MySQL Database Backup select the Database you wish to Backup
    3. Select Save File
    4. Repeat Steps 2 and 3 for any other Database you wish to backup

Consider the following steps to RESTORE your site:

  • To Restore the files of your site:
    1. On CPANEL select option Backups
    2. Under Restore a Home Directory Backup select Browse and locate the backup you want to restore from
    3. Select Upload
  • To Restore the Databases of your site:
    1. On CPANEL select option Backups
    2. Under Restore a MySQL Database select Browse and locate the backup you want to restore from.
    3. Select Upload
    4. Repeat Steps 2 and 3 for any other Database you wish to restore

How to move a WordPress site to a different Server or URL

Moving a WordPress site from one server to another or to a different Web address (URL) may seem a daunting task and something to stay away from. The truth is that it is quite simple!

Last month I was asked to help moving a WordPress (WP) blog from one server to another and I thought I should share with the world how this can be done.

Performing this task requires 3 major steps:

1. Move the WordPress Source Code
2. Move the WordPress Database
3. Update the WordPress configuration

For the sake of this example I will provide the general instructions for a WordPress running on LAMP (Lunix, Apache, MySQL and PHP) environment with CPanel and I’ll assume that we want to move it from http://www.original-server.com/blog to http://www.destination-server.com/blog.

STEP 1 – Move the WordPress Source Code:

(Original server)- Download the WordPress source files:

1. On CPanel select “File Manager
2. Tick (check) the folder that contains the WordPress blog source files (ex: blog)
3. Select “Compress” from the menu
4. Select “Compress File(s)
5. Tick (check) the zip file you’ve just created
6. Select “Download” from the menu and save the zip file locally
7. Once the download is finished delete the zip file from the server

(Destination Server) – Upload the WordPress source code:

1. On CPanel select “File Manager
2. Select the “Upload” option
3. Locate and select the zip file that contains the WordPress source code you’ve copied into your PC.
4. Upload your file into the new server
5. Select the zip file
6. Select “Extract” from menu
7. Delete Zip file from server

Note: Beware! When you unzip the file if a directory already exists with the same name its content will be replaced!

STEP 2 – Move the WordPress Database:

(Original Server) – Export WordPress Database:

1. On CPanel select option “phpMyAdmin” (MySQL Databases)
2. Select the WordPress Database that you want to export (ex: wp01)
2. Select “Export
3. Make sure all the Tables are selected
4. Leave all the default options ticked
5. Make sure to download as an SQL file
6. Check “Save as File
7. Click “Go” and save it locally

Note: In addition you may also select “zipped” or “gzipped” to compress your database when downloading it.

(Destination Server) – Create new Database:

1. On CPanel select “MySQL Databases
2. Create a new DB for the blog (ex: wp01) and if possible with the same name as it had originally
3. Create a new user for the blog if possible with the same name as originally
4. Associate the new user with the WordPress Database you’ve just created and all privileges to it.

(Locally) – Update WordPress MySQL database:

1. Edit the WordPress SQL database you’ve downloaded from the original server.
2. If the web address URL has changed:

  • replace all references of the old URL with the new URL
  • note that if on the new server you’re using a different directory, this needs to change too.

3. If the email addresses have changed, replace them with the new addresses.
4. Save your changes.

(Destination server) – Upload WordPress Database:

1. On CPanel, select “phpMyAdmin” (MySQL Databases)
2. Select the WordPress Database
3. Select the “Import” option
4. Locate and select the WordPress SQL Database you have saved locally.
5. Import file

STEP 3 – Update the WordPress configuration:

(Destination Server) – Update config file:

1. On Cpanel select “File Manager
2. Locate and edit WordPress configuration file “wp-config.php
3. Update WP DB name with the new WordPress Database name:   define(‘DB_NAME’, ‘database_name_goes_here’);
4. Update user name: define(‘DB_USER’, ‘user_name_goes_here’);
5. Update Database password: define(‘DB_PASSWORD’, ‘password_goes_here’);
6. Update hostname (if required): define(‘DB_HOST’, ‘hostname_goes_here’);
7. Save your changes

STEP 4 – Testing:

1. Simply test your blog to make sure that all the functionalities are available

PHP Session not being passed from a web site to WordPress

Recently I had this case where a PHP session ($_SESSION) was not being passed from a web site to WordPress.

Basically, WordPress was installed and configured to be part of a web site and there was the need to use Sessions to control the login/logout process of the site.

Although the session_start() had been defined to WordPress, the latter did not recognize the session values and therefore simply ignored if a user was logged on.

After some research and some brainstorming with some great experts on the field, I realized that the problem was in the WordPress URL itself.

The problem was that although the domain was the same, WordPress was suppressing the “www” from the URL which caused the $_SESSION values not to be recognized.

Example:

Site URL: http://www.this-is-an-example.com

WP URL: http://this-is-an-example.com  (missing the “www.”)

Solution:

By adding the “www.” to the WordPress domain name the problem was solved:

  1. Login to WordPress Admin area
  2. Go to SettingsGeneral
  3. Add “www.” to the WordPress address (URL) and Blog address (URL).