Import Some Posts with and Some without Image in WP All Import

In a unique case, I had to create ~1,000 posts by using the techniques of programmatic SEO by using the plugin WP All Import — where some posts were going to have an image whereas some did not. I tried several methods to do this inside WP All Import, but nothing quite worked as expected.

However, finally, I got a working solution for this that I will explain in this blog post.

Creating Pages With/Without Images using WP All Import

For this, you do not need any additional tool or setup inside the WP All Import plugin, but you will have to do this inside Google Sheets itself.

Allow me to explain…

1. Create an Additional Column for the Image

If you have image URLs in a column (say, column A) in your Google Sheets, you need to create another column (say, column B). And write HTML code for adding an image to a webpage in column B by referring to column A.

Variable Images in WP All Import

As shown in the above screenshot, you need to write the HTML code with the <img> tag, and also use the IF condition for rows which have no image. The formula will be something like below:

=IF(A2="","","<img src="""&A2&""" width=""100%"" height=""auto"" />")

Not to mention, you will have to replace the A2 cell in the above formula with the cell reference with image URLs in your Google Sheets file.

2. Import HTML Image Code to WP All Import

Now, it’s almost done.

When running the import, instead of directly importing the image URL, import the HTML code of the image. In the above example, import {imagehtml[1]} instead of {imageurl[1]}.

This method might not seem like a smart thing to do if you are only dealing with one image, but if the number of images per post varies, then this becomes the only option to go with. You can directly prepare the complete HTML right inside Google Sheets, and you’ll be good to go.

I also have a video explaining different ways to handle images when doing pSEO in WordPress by using the WP All Import plugin.

That’s it.

If you require additional help or have any questions, kindly feel free to let me know in the comments below.

Join pSEO newsletter

✦ Loved by 1,000+ SEOs

✦ Not more than 2 emails a month

DeepakNess Avatar

Written by:

Leave a Reply

Your email address will not be published. Required fields are marked *