PHP Code SnippetAfter installing a child theme, navigate to Appearance > Theme Editor > functions.php and paste at the bottom of the input.
Instructions
SEOPRESS PLUGIN ONLY
function sp_social_og_thumb_dynamic_multiple_ids($html) { if (is_single()) { global $post; $image_ids_string = get_post_meta($post->ID, 'gallery', true); // Assuming this returns a string of comma-separated IDs $image_ids = explode(',', $image_ids_string); // Split the string into an array of IDs
if (!empty($image_ids)) { $first_image_id = trim($image_ids[0]); // Get the first ID and trim whitespace $first_image_url = wp_get_attachment_url($first_image_id); // Get the full URL of the image