How to autogenerate custom yoast social media cover image

by odorf   Last Updated July 14, 2018 16:08 PM

I have a wordpress blog and I use Yoast for SEO purpose. I want my facebook and twitter posts to have a custom image cover, so I have written a php script that takes the cover image of a post, applies an overlay that I made and creates two new images.

What I want to know, is if there is a way to run this script when I click "Save Draft" or "Publish" and automatically set the new images as cover images for social media in Yoast.

Until now i have been doing this manually, adding the url of the newly created images to the Yoast section at the bottom of the editor when creating a new wordpress post. I have been searching the Yoast api for a while, but I am not proficient in this CMS, and the documentation is not exactly helpful.

Can at least someone point to a helpful direction? Is there anyone else that faced the same problem?

I don't know if this is where I should be asking question for a wordpress plugin, so I am sorry in advance, if it is not.

Related Questions

How to roll back a wordpress plugin update?

Updated June 01, 2015 23:03 PM

Fatal error in wordpress

Updated September 28, 2017 17:08 PM

Change/ Add head meta in custom file

Updated November 28, 2017 10:08 AM

Yoast SEO Calling content filters 2 additional times

Updated October 26, 2016 09:03 AM