An automated WordPress Update has Failed to Complete

Checking a website the morning after a recent WordPress update I found that the update had failed.

At the top of the admin page an error message was showing the message:

An automated WordPress update has failed to complete - please attempt the update again

As per the instruction I clicked on the link to run the update once more.

But that failed too! The message was still showing at the top of the admin screen.

WordPress uses a file in the root of the WordPress installation to determine whether it’s in maintenance mode.

The file named .maintenance is added by the WordPress updater to the root of the WordPress website.

Here’s the scary part. If I delete the file will it cause damage to my WordPress website?

I would allow sufficient time to ensure that WordPress has completed the task which put it into maintenance mode. The update process is reckoned to take not more than 10 minutes, but allow a few more to be sure.

If its an update to the WordPress core files then it will be clear when the task is completed.

As you are searching for reasons for the maintenance mode error message the associated task ought to be complete.

I deleted the file .maintenance from the WordPress root folder.

I clicked on the dashboard link on the admin page, preferring not to click on the update link.

Resolved the failed update notification was gone.

The version of WordPress indicated as installed was the latest one.

WordPress Update – 504 Gateway Time-out

Looking to update WordPress to the latest version, I clicked on update, but after a while I received the following error:

504 Gateway Time-out
The server didn't respond in time.

So what to do?

Sometimes with WordPress updates its worth being patient. I’ve seen errors which when returning to the site have cleared. In this case the same was true. I visited the site direct, public view. All was well, but an update was marked as outstanding. It then went to the admin with the WordPress core update pending.

So I refreshed the browser tab with the with the 504 gateway error. And low and behold all was well the update was completed.

One moment of hesitation – a single update was still being shown in the black top bar. But all was well it was a plugin which needed to be updated, based on the newer version of WordPress.

Option to update to WordPress 4.9–en_GB Missing

On one of my websites the option to update to the local language version is missing.

This is what I’m expecting to see

An updated version of WordPress is available.
You can update to WordPress 4.9–en_GB automatically:
This localised version contains both the translation and various other localisation fixes. You can skip upgrading if you want to keep your current translation.
You can update to WordPress 4.9–en_US automatically:

While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.

But for this site I only had the option to do the non-localised language update.

How to install the en-GB version of WordPress?

in the root file wp-config.php I had

//define(‘WPLANG’, ”);
define (‘WPLANG’, ‘en-GB’);

I found that this is now deprecated. As of WordPress version 4.

To set the locale for the WordPress website the variable $locale is set accordingly within the file wp-config.php, found in the root of the website.

I replaced it with

//define(‘WPLANG’, ”);
//define (‘WPLANG’, ‘en-GB’);

and it worked!

Note the change from a hyphen to and underscore.

Further Reading

If you are interested in reading further about wplang and its deprecation these links may interest you.

wplang WordPress forum

wplang in wp-config

wplang deprecation in version 4 notification

Changeset 29630

Disable Login Using Email Address

WordPress allows login by either username or email address.

But, email addresses are more likely to be common knowledge. Or perhaps easier to guess. We tend to keep our email addresses to set patterns.

Its all very well having a fancy obscure username but if the email address associated with the account is easily guessable, all that effort has been wasted.

An email address could be created, just for logging into the website. It could be made obscure and configured to forward emails. But this is looking like a username. Would it not be better to configure WordPress to block logins using email addresses, only allowing logins using a username and password?

A set of random characters, upper case and lower case, together with numbers and symbols can make a good choice for a username, but not a good choice for an email address. Who would be comfortable receiving an email from such an address?

Do you really wish to create a separate obscure email address (a shadow email address) for every registered user – or at least admin user of a WordPress website?

I can explain to my customers the need to have an obscure username to access their website. But to suggest that a second email address should be created for them to use…

So I have another little section of code to be added to the functions.php file included within my theme files.

* Block login by email address
remove_filter( 'authenticate', 'wp_authenticate_email_password', 20 );

There you are the simple solution.

With the above code login to a WordPress website using the account email address is blocked. Access using the likely more easily guessed email address has been stopped.

Now to sell to my customers the idea of using a username as equally obscure as their password!


Deleting the WordPress Uncategorized Category

So you have numerous blog posts, on your WordPress website, which are assigned to the uncategorized category.

Maybe you have recently imported lots of posts or perhaps found that you forgot to set the category when creating the posts.

For myself I was transitioning a website and had forgotten to consider this category assignment. Each imported post was assigned to the default uncategorized category.

Considering the situation, I really didn’t want every blog post to have this category assigned. Which led me to ask the questions:

Can I simply delete the uncategorized category?

What about all the posts which have this category assigned?

Let’s begin by reviewing the categories. Navigate to the categories, under the posts at the left menu.

Remove WordPress Uncategorized Category List of Caetgories

As can be seen in the above image because the uncategorized category is set to be the default it’s not possible to delete it.

The next admin page to visit is the Writing Settings.

Start by changing the default category

Remove WordPress Uncategorized Category Writing Settings

Here we’ll change the default category to something else.

Change the category to one you are most likely to use. It’ll save effort in the future and will provide a safety net, in case you forget to set one.

Remove WordPress Uncategorized Category Delete Unwanted Category

Once deleted each post which was assigned to the uncategorized category will be assigned to the new default category.

But STOP think about this next step.

As the situation was I knew which posts had recently been imported – they were all assigned to the uncategorized category.

If I were to now choose to set my most likely used category as the default and delete the uncategorized category all of these per would be mixed up. Not all of the posts world be correctly associated to the category.

For example if I set the new default category as fruit then that would work well for plums, apples and pears. But deleting uncategorized and consequently automatically associating carrots and brand to the category fruit would be wrong. How would I spot these wrongly associated categories?

To finally complete the task would entail reviewing the list and unassigning via Quick Edit as required.

It’s easy to list those entries assigned to uncategorized, a simple filtering by category on all posts is all that’s required.

Each of these entries can be edited as necessary using Quick Edit.

But it’s time consuming. Against this – there is less chance of making and maintaining a wrong association.

Once your list of filtered entries is down to 0 the uncategorized category can be removed and a new default set.

From this exercise in importing posts I concluded that whilst the uncategorized category can be deleted before starting, its better to leave it in place. Or create/rename the category as Imported. The posts should then be reviewed unassigning them from the imported/uncategorized category until the list of assigned entires is zero. Only then can the uncategorized category be deleted.

WordPress Missing Text Underline in Editor

I can’t find an underline option in the WordPress editor.

How to underline text?

I’ve used the WordPress plugin TinyMCE Advanced before to allow a client to set the font size.

I added it to the website, this time to be able to select words in the post to be underlined.

WordPress missing text underline

The TinyMCE Advanced plugin adds an additional line of editing options to the editor, above the existing set of icons.

Highlight the words to be underlined. From the new editing options click on Format and select underline.

Looking at the drop down menu of options I was reminded of the <CTRL> key combination for underlining: <CTRL> + u.

I disabled the plugin and tried underlining some text within the editor using <CRTL> + u. As expected it worked!

If you are missing the underline icon within the WordPress editor you can still underline text using a key combination or by adding a plugin.

Add a Class to WordPress Body using body_class

For a WordPress website theme I was using the body_ class function in the body tag.

<body <?php body_class(); ?>>

This was adding relevant classes into the body.

I wished to add another class to the body. In this case for a customer  review. For a presentation I wished to provide a comparison between a modern responsive theme and an older style where the page doesn’t resize appropriately.

I added an unresponsive class to the WordPress website via the HTML body which would be used to stop a bootstrap based website from being responsive.

This is the relevant section of the header.php file

<?php wp_head(); ?>


<body <?php body_class(); ?>>
<a href="#content" class="skipnav">Skip to content</a>
<div id="page" class="hfeed site ">

To make the change I amended the functions.php file.

Within this you can add the additional classes via the body_class filter. I chose to add just the one class.

add_filter( 'body_class', function( $classes ) {
return array_merge( $classes, array( 'unresponsive' ) );
} );

Reviewing the website source I was able to see the class added, within the body and the website was adopting the presentation fro the additional class.


Change WooCommerce Product Category List Order

Changing the order in which WooCommerce displays product categories to create a custom order.

To do this I navigated to the admin page Products > Categories.

On this categories page is shown a list of the various products order with child entries beneath their parent.

Viewing this page there is no textbox along the row to set the numeric order. Checking on the left for adding a new entry, likewise.

Change WooCommerce product category list order

So how is the order of the category entries set?

On the Product category page to chagne the order of the entries simply drag the relevant item up or downto the positin you wish it to take.

Change WooCommerce product category list order move entry

Once an entry has been moved the little spinner will show whilst the updated order is being saved.

After the page has refreshed and the spinner has stopped the parent page has moved. And better still, all the child entries have been relocated too!

Change WooCommerce product category list order reordered

Enable WordPress Missing Post Revisions

WordPress provides post revisions. A great way to step back to a prior version of your post!

Whilst writing blog posts I’ve used the post revisions to check a previous version of a paragraph, or idea. and that all important recovery of a post which has had parts deleted in error.

The post revisions are shown on the right hand side of the Edit Post screen, within the Publish section.

How to enable the post revisions.

If the post revisions aren’t showing

At the top of the page there’s a tab marked as Screen Options. Click on this to expand.

Within this area are the content options which may be displayed. Check that the Revisions check box is ticked.

Click on Screen Options again to close.

The post revisions option will only show once you have saved the post a number of times.

should be option under publish section at top right of post edit page

I have also seen it written that adding

define(‘WP_POST_REVISIONS’, false);

to the file wp-config.php in the root of your website may also be required. I’ve not found that I needed to add this.

Rather than filling the database with lots of post revisions, potentially slowing your website, you can limit the number of post revisions. I like to set this to 20 maximum.

In summary to be able to view the previous post revisions of your blog port ensure that the Revisions check box is ticked in the Screen Options and you’ll need a history of post revisions before it is shown.

WordPress How to Add alt Text to an Image

WordPress makes the management of images easy with the media library.

As described in the article Why add ALT Text to an Image? it’s important to have alt text assigned to an image, for SEO.

In WordPress, to add the alt text click on the media library link, on the left menu.

WordPress Media Library

Find and click on the image which you wish to modify.

Image alt Text WordPress Attachment Details

As shown in the image above, on the left is a picture of the image and to the right options to be completed.

The entry of interest is labeled as Alt Text. Click on the textbox and enter your descriptive text.

In the above image I gave the image the Alt Text description of Red BT Telephone Box.

The alt text should be informative, but keep it succinct.

I’ve left the Title text as per the original file name of the image (as auto-filled). You may wish to make this more descriptive too.

As changes are made the details are updated. Confirmation of this is a small spinner which appears at the top.

Once completed, simply close on the cross at the top right corner to close the pop-up.