Support » Plugin: Yoast SEO » Twitter:image does not display on attachment pages

  • WP 3.5.1
    WP SEO 1.4.6

    “Add Twitter card meta data” is enabled but the “twitter:image” meta tag does not get output when viewing an attachment page. If a default image is set site wide then this default image always displays instead of the preferred attachment image.

    I think I’ve narrowed the problem down to the image function in class-twitter.php. Basically the first if statament doesn’t account for the page being an attachment.

    Replacing the line:
    if ( function_exists( 'has_post_thumbnail' ) && has_post_thumbnail( $post->ID ) ) {
    if ( (function_exists( 'has_post_thumbnail' ) && has_post_thumbnail( $post->ID )) || is_attachment()) {
    seem to fix the problem but not sure if it’s the best solution.

  • The topic ‘Twitter:image does not display on attachment pages’ is closed to new replies.