Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Overwrite Yoast SEO Facebook & Twitter sharing images declaration with a custom one.
* Std image size for social sharing.
add_action( 'after_setup_theme', 'mytheme_setup_theme' );
function mytheme_setup_theme() {
add_image_size( 'social-800x420', 800, 420, true );
* Replace default sizes with std one.
add_filter( 'wpseo_opengraph_image_size', 'mytheme_social_image_size' );
add_filter( 'wpseo_twitter_image_size', 'mytheme_social_image_size' );
function mytheme_social_image_size($val) {
return 'social-800x420';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.