Developer Reference
This is the technical reference for External Images. It covers the post meta the plugin reads and writes, the developer-useful constants, the filters you can hook, and the SSL proxy endpoint. Everything here reflects the plugin code, so you can rely on it when building imports, integrations or theme tweaks.
The external_image_url meta key
External Images stores its image URLs in the external_image_url post meta on the post, product or variation. The value is a single meta value holding a plain string, not multiple meta rows. You may put one URL or several URLs in that string.
When more than one URL is supplied, the first URL becomes the featured image and the rest become the gallery. Both comma and pipe (|) separators are accepted. Internally the plugin normalises comma separators to pipes (it rewrites ,http, , http, ,// and , // to |) and then splits on the pipe character, trimming whitespace and dropping duplicates. A pipe is the safest separator to author with, because a comma inside a URL query string will not be misread.
Author with the pipe (|) separator, not the comma. Feed and CDN URLs routinely carry commas in their query strings, and comma-splitting will chop those URLs in half. The pipe never appears in a real URL, so it is always safe.
Setting the meta programmatically is a normal update_post_meta call:
// Single external featured image
update_post_meta( $post_id, 'external_image_url', 'https://cdn.example.com/product-a.jpg' );
// Featured image plus two gallery images (pipe separated)
update_post_meta(
$post_id,
'external_image_url',
'https://cdn.example.com/a.jpg|https://cdn.example.com/b.jpg|https://cdn.example.com/c.jpg'
);
That is the whole contract. The plugin does the rest at display time. There is no need to create attachments.
External Images reads and writes several supporting meta keys. You will not normally set the internal ones by hand, but they are useful to know when debugging.
| Meta key | Role |
|---|---|
external_image_url | Primary field you set. One or more URLs, comma or pipe separated. |
merchant_image_url | Datafeedr merchant image URL. Read as a fallback when external_image_url is absent. |
_dfrps_featured_image_url | Datafeedr comparison-set image URL. Read as a further fallback. |
eigallery | Extra gallery URLs (pipe separated). Appended to the gallery if present. |
gallery_urls | Extra gallery URLs (pipe separated). Appended to the gallery if present. |
external_image_alts | Pipe separated alt texts, matched positionally to the image list. |
external_image_titles | Pipe separated titles, matched positionally. |
external_image_captions | Pipe separated captions, matched positionally. |
_ei_wcgallery | Internal, processed WooCommerce gallery structure the plugin builds from the URLs. Managed by the plugin. |
_external_image_url | Internal array representation of the resolved featured image. Managed by the plugin. |
eili | Internal marker recording which source field was chosen (mi = merchant, df = Datafeedr). |
ei | Internal flag set to 1 when a post has external images. |
The lookup order for the featured image is external_image_url, then merchant_image_url, then _dfrps_featured_image_url. For a plain WP All Import or custom import, put your URLs in external_image_url and ignore the Datafeedr fields. See “How to Alter Import Jobs to Import External Images” for the import-side detail.
Constants
Developer constants live in external-images/defines.php. Each is defined with an if (!defined(...)) guard, so you can override any of them earlier, for example in wp-config.php, before the plugin loads. All confirmed defaults are shown below.
| Constant | Default | Purpose |
|---|---|---|
EI_ADD_FEATURED_IMAGE_TO_GALLERY | false | When true, prepends the featured image to the WooCommerce gallery so it also appears as a gallery slide. |
EI_SHOW_VARIATION_IMAGES_IN_MAIN_GALLERY | false | When true, a variable product’s main gallery includes the gallery images of all its variations. |
EI_GRAB_PARENT_GALLERY_IF_NO_GALLERY | false | When true, a product or variation with no gallery of its own falls back to the parent product’s gallery. |
EI_VARIATION_GALLERY_WRAPPER_CSS | .woocommerce-product-gallery | CSS selector the front-end JavaScript targets to swap gallery images when a variation is selected. Change it to match your theme, for example .rtwpvg-images or .woo-variation-product-gallery. It is passed through to the script as variation_gallery_wrapper_css. |
EI_NEVER_ATTEMPT_PROXY | false | When true, the “Proxy All Images” behaviour is disabled: the local-caching proxy function returns the original external URL untouched. |
EI_BETA | false | When set to true (add define('EI_BETA', true); to wp-config.php), the plugin opts in to beta update releases. |
EI_DISABLE_VARIATION_JS has been moved into the settings page and is no longer an active constant, the definition is commented out in defines.php. Control it under Settings with the “Variation Gallery JavaScript” option, which is stored in ei_settings['disable_variation_js']. Set it there if you find variation galleries are not clickable. For the behaviour behind these options, see “WooCommerce Variation and Gallery Images”.
Filters
ei_user_resized_images gates the plugin’s on-the-fly image resizing (the Photon-style resize applied when rendering an external image at a requested size). It defaults to true. If the “Resize images” setting is off, the plugin itself adds add_filter('ei_user_resized_images', '__return_false'), which turns the resizing off. You can hook it to force the decision either way:
add_filter( 'ei_user_resized_images', '__return_false' ); // never resize
See “Photon image resizing” for what that resizing does.
WoodMart integration
On WoodMart themes the plugin wires itself into WooCommerce’s variation and gallery pipeline: it filters woocommerce_available_variation, overrides the woo_variation_gallery_images and rtwpvg_images meta reads, and, when building variation gallery markup, passes the image class through WoodMart’s own woodmart_single_product_gallery_image_class filter so WoodMart’s gallery styling still applies to external images. These are integration points the plugin consumes rather than a public API you are expected to call, but they are the hook names to look for if you are debugging WoodMart gallery display.
The SSL proxy endpoint (ssl-proxy.php)
ssl-proxy.php is a small standalone script that streams a remote image through your own domain. It is called with a single img query parameter holding the source URL, for example ssl-proxy.php?img=https://third-party.example/pic.jpg. It reads the image, checks its MIME type, accepts only image/png, image/gif and image/jpeg, then emits the correct Content-Type header, a one week Cache-Control: max-age=604800 header, and the image bytes. This lets a non-SSL or third-party image be served over your HTTPS domain, which fixes mixed-content warnings and keeps social scrapers and SEO tools happy.
Note that EI_NEVER_ATTEMPT_PROXY does not govern this file. That constant controls the separate “Proxy All Images” caching path (the ei_maybe_proxy_image_url function), which downloads and caches remote images under wp-content/uploads/external-images/. The two are independent proxy mechanisms. Because ssl-proxy.php fetches whatever URL it is handed, treat it as a sensitive endpoint and do not expose it more widely than your own image rendering needs. For the full picture, see “The SSL Image Proxy”.
Setting external images during import
The meta-based approach is the whole point of the plugin for large or feed-driven catalogues: map your image URLs into the external_image_url meta and do not import images the normal way. The site then renders from the external URLs, skipping the download and resize step entirely. The exact mapping steps for WP All Import and similar tools are in “How to Alter Import Jobs to Import External Images”.
Because you are writing a single meta value rather than creating attachments, setting external images is just an update_post_meta call per product. There is no image download, no thumbnail generation, and nothing to clean up afterwards, which is exactly what makes bulk and feed imports fast.

Comments