WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. harrisric
    Member
    Posted 1 year 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 ) ) {
    with:
    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.

    http://wordpress.org/extend/plugins/wordpress-seo/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic