Archived topic
Og image size - Width and Height
5 replies · Started by Craig on March 22, 2022
Hi
Is it possible to use a hook, displayed in wp_head to change the og metadata tags
They are currently
meta property="og:image:width" content="1500"
meta property="og:image:height" content="1500"
and I would like them to be
meta property="og:image:width" content="1200"
meta property="og:image:height" content="630"
Thanks
Craig
Hi there,
no, you would need to check with the developer of the plugin ( I assume Yoast ) on how to filter those values. But I assume the width and height is taken from the image you told Yoast to use ?
Yes, I am using Yoast and the size is my original image size, but the image gets cut when sharing on Facebook and doesn't display nicely.
When you create an image in WordPress, WordPress creates about 5 or 6 other images of different sizes. How do I access these and see them in the media library? or make them available to be used?
I found this topic which provides some PHP Snippets that looks like what you need:
https://travis.media/how-to-change-the-open-graph-image-size-in-yoast/
This doc explains how to add PHP:
https://docs.generatepress.com/article/adding-php/
Probably worth speaking with Yoast on this though
Thanks David
Much appreciate the help
You're welcome