Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
/* @link
/* Add custom Twitter Social Share images for Yoast SEO for Archive pages
add_filter( 'wpseo_twitter_image', 'ag_yoast_seo_tw_share_images', 10, 1 );
function ag_yoast_seo_tw_share_images( $img ) {
if( is_post_type_archive( 'archivename') ) {
$img = get_stylesheet_directory_uri().'/images/your-image-file.jpg';
iif( is_category( 'categoryname') ) {{
$img = get_stylesheet_directory_uri().'/images/your-image-file.jpg';
return $img;
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.