Appearance
Media Fetching & Image Optimization Filters
When a template has image optimization turned on, WP Social Ninja downloads each remote avatar, cover, and media image and stores a resized copy under wp-content/uploads/wp-social-reviews/. These filters tune the limits that path runs under — how large a download may be, how long it may take, how many images may be resized in one window, and how wide the stored header copies are.
Unreleased
These filters are not in 4.4.0. They are documented ahead of the release that ships them — confirm against the changelog before depending on one.
All limits are optional. Every filter falls back to its default when handed a value that is not a positive integer, so a mistake in a snippet degrades to current behaviour rather than removing the limit.
wpsocialreviews/remote_media_max_bytes Unreleased
wpsocialreviews/remote_media_max_bytes — Download size ceiling for one remote image
When it runs: Resolved once per download, before the request opens. The value caps the transport (limit_response_size) and is re-checked against the file on disk afterwards, so a response that overruns the ceiling is discarded instead of stored. Return a size in bytes.
Parameters:
$bytes(int): the current ceiling. Default8388608(8 MB).
Source: app/Services/Platforms/RemoteMediaFetcher.php
Usage:
php
add_filter('wpsocialreviews/remote_media_max_bytes', function ($bytes) {
return 20 * 1024 * 1024;
});Raising this also affects the resize step
The download is streamed to disk, but wp_get_image_editor() decompresses the file into memory to resize it. On a host with a low memory_limit, a large ceiling trades a rejected image for a fatal error partway through optimization. Raise it in steps and watch the error log.
wpsocialreviews/remote_media_timeout Unreleased
wpsocialreviews/remote_media_timeout — Per-request timeout for remote media
When it runs: Applied to the image download, and to the HEAD pre-check that runs before it (ImageOptimizationHandler::isValidImageUrl()). Both read the same value, so raising it covers the whole path rather than only the download. Return seconds.
Parameters:
$seconds(int): the current timeout. Default10.
Source: app/Services/Platforms/RemoteMediaFetcher.php
Usage:
php
add_filter('wpsocialreviews/remote_media_timeout', function ($seconds) {
return 30;
});wpsocialreviews/max_resizing_per_window Unreleased
wpsocialreviews/max_resizing_per_window — Images resized per throttle window
When it runs: Checked before each resize batch. When the number of rows written to wpsr_optimize_images inside the current window reaches this ceiling, resizing stops until the window rolls over. Return a count.
Parameters:
$limit(int): the current ceiling. Default100.
Source: app/Services/Platforms/BaseImageOptimizationHandler.php
Usage:
php
add_filter('wpsocialreviews/max_resizing_per_window', function ($limit) {
return 300;
});wpsocialreviews/max_resizing_window_minutes Unreleased
wpsocialreviews/max_resizing_window_minutes — Length of the throttle window
When it runs: Alongside wpsocialreviews/max_resizing_per_window, to decide how far back the row count looks. Return minutes.
Parameters:
$minutes(int): the current window length. Default15.
Source: app/Services/Platforms/BaseImageOptimizationHandler.php
Usage:
php
add_filter('wpsocialreviews/max_resizing_window_minutes', function ($minutes) {
return 30;
});The throttle fails quietly
When the window fills, optimization stops with no admin notice — images keep serving from their remote URLs. A large feed that never finishes optimizing is the usual sign that this ceiling was reached. Raising it costs request time on the resize AJAX endpoint, so a big jump can trade that symptom for a request that exceeds max_execution_time.
wpsocialreviews/optimized_header_image_size Unreleased
wpsocialreviews/optimized_header_image_size — Stored avatar and cover width
When it runs: When a header image is resized for local storage. Applied once per image, with the header type and platform passed alongside the default so you can vary the width per platform. Return a width in pixels; the height follows the source aspect ratio.
Parameters:
$size(int): the default width —150when$headerMetais'avatars', otherwise600.$headerMeta(string):'avatars'for the profile image, anything else for the cover.$platform(string): the platform the header belongs to, for exampleinstagram.
Source: app/Services/Platforms/ImageOptimizationHandler.php
Usage:
php
add_filter('wpsocialreviews/optimized_header_image_size', function ($size, $headerMeta, $platform) {
if ($headerMeta !== 'avatars') {
return $size;
}
return $platform === 'instagram' ? 300 : $size;
}, 10, 3);Only the image-editor path honours this
When no WP_Image_Editor is available — GD and Imagick both missing, or neither can open the format — the header falls back to storing the downloaded bytes at their original size, and this filter has no effect on that copy.
What is deliberately not filterable
The accepted image types and the redirect ceiling in RemoteMediaFetcher are a security boundary, not a tuning knob. Every stored URL is fetched through that one class so the destination is address-checked on each hop and the bytes are confirmed to be a real image before anything is written into the uploads tree.
Do not work around the type gate
There is no filter for the accepted image types, and adding one would let arbitrary downloaded content reach the uploads directory. If you need a format the plugin does not store, open an issue rather than patching the list.

