• Problem solving – verse 23 – Environment?

    Q. Have you ever wondered why your images are broken after cloning your WordPress site’s database and copied the latest folders from wp-content/uploads?

    A. There’s a simple answer. You didn’t copy all of the latest images.

    Problem solving – verse 23

    And regarding the data,
    you'll think that I'm a chump
    "but does it work on Windows
    running last Wednesday's dump"?
    

    Explanation

    It’s very easy to get broken images in WordPress.

    1. Export your production database
    2. Import your production database into a local development environment
    3. Update wp_options to make it work
    4. Forget about copying the attached media files

    To resolve this issue you copy the attached media files from the latest months’, so that your directory structures match.

    Sorted? Not quite.

    You may have missed some images that were uploaded recently but are not where you might have thought they should have been.

    • Here we see a broken image in my local copy of oik-plugins.com
    • This new image was uploaded in October 2014
    • But the post that it was attached to (the oik themes server plugin) was originally created in July 2013
    • So WordPress put the newly attached media file in the 2013/07 folder
    • And since my previous database clone was more recent than July 2013 I didn’t clone the uploads folder

    Techniques for future consideration

    It won’t just be media files that are out of date; there’s plugins and themes and even WordPress core that may be different. So it makes sense to take a full backup of the files as well.

    Alternatively, when adding a new media file to an existing post, use this process:

    • Use Media > Add New to upload the file
    • Attach the file to the post
    • Edit the post to make the changes required to refer to the new file
    • And if necessary, delete the file(s) that the new file replaces.

    Suppose you have some content that is valid from a certain date. It would look odd if it appears to have been stored in the system earlier than it was created. And maybe you should also consider displaying the Last update date for your main content.

    This is a good idea for date sensitive files such as a Statement of Professional Standing, Newsletters attached to a Newsletters page, or banner images for new versions of plugins 🙂

    Further reading


    ,

    Published:

    Last updated:

    November 3, 2019

Categories

Tide times from tidetimes.org.uk

Tide Times & Heights for Langstone Harbour on
4th December 2023
03:48 High Tide ( 4.09m )
08:48 Low Tide ( 2.03m )
15:46 High Tide ( 3.84m )
21:15 Low Tide ( 1.91m )

Tide times from tidetimes.org.uk

Tide Times & Heights for Northney on
4th December 2023
04:09 High Tide ( 3.96m )
09:06 Low Tide ( 1.86m )
16:13 High Tide ( 3.74m )
21:39 Low Tide ( 1.7m )