Through the Yoast SEO plugin, I've added a 1200 by 630 image for use by sites like Facebook and LinkedIn (and the image shows up with a complete set of og meta tags).

I want to add a second open graph image (a square one) for use by WhatsApp (WhatsApp selects the last image and crops it to a 1 by 1.3 portrait aspect ratio and then displays it at 80 by 104 pixels, which doesn't work well with the image layout that works well with Facebook (and LinkedIn).

I don't think Yoast directly supports a second image, but is there a way using functions.php to add a second image (with the op:image, og:image:secure_url, og:image:height, og:image:width, and og:image:alt meta fields)? I wouldn't need the image data to be done programmatically, as I would use the same image for every page, so the information could be hard coded into functions.php.

Thanks for the help.

I've reposted the question at Stackoverflow for help with the PHP code.

  • How comfortable with coding are you? – Matthew Brown aka Lord Matt Aug 15 '19 at 7:04
  • @MatthewBrown - I'm okay with coding if I can get pointed in the right direction. I found a tutorial by Igor Benić from a couple of years ago that an add_action function to hook into wpseo_opengraph, but couldn't get it to work (the code replaced the og:image, not add a second image). – Rich DeBourke Aug 15 '19 at 11:09