Created
April 4, 2018 09:37
-
-
Save danmaby/a8624dcdde9f192f28a83c0361b17870 to your computer and use it in GitHub Desktop.
Replace og:image on custom post type archive
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 | |
// CPT Talks - replace og:image | |
add_action( 'wp_head', 'prefix_add_og_image', 10, 1 ); | |
function prefix_add_og_image( $img ) { | |
if( is_post_type_archive( 'post-type-archive-wpldn_talk' ) ) { | |
echo '<meta property="og:image" content="https://www.wpldn.uk/wp-content/uploads/2018/03/2018-02-22-WPLDN_Primary-Image-2.jpg" />'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment