Yoast SEO
Twitter:image does not display on attachment pages (1 post)

  1. harrisric
    Posted 3 years ago #

    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.


Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Yoast SEO
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic