Adding og:image to custom post type archive?
-
I am trying to add a custom image to a custom post type archive. I have found the code below on the web but if I add it to my theme functions.php my site does not work anymore HTTP 500 error. Any ideas?
add_filter(‘wpseo_opengraph_image’, ‘cpt-archive-image’, 10, 1);
function cpt-archive-image($og_image) {
if( is_post_type_archive(‘my_cpt’) )
$og_image = ‘https://www.example.com/my-image.jpg’;return $og_image;
};
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Adding og:image to custom post type archive?’ is closed to new replies.