Last active
March 4, 2020 00:31
-
-
Save kristarella/7e02cfad2985d06c9439e4785ecfc2de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/ | |
/* Change Open Graph image URLs in Yoast SEO for categories + Taxonomy Images plugin */ | |
add_filter( 'wpseo_opengraph_image', 'change_opengraph_image_url' ); | |
function change_opengraph_image_url( $url ) { | |
$image_url = apply_filters( 'taxonomy-images-queried-term-image-url', '' ); | |
if (is_category() && $image_url) { | |
return $image_url; | |
} else { | |
return $url; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment