WordPress.org

Ready to get started?Download WordPress

Forums

Fix for bug in wp_get_attachment_thumb_file (4 posts)

  1. frankindelicato
    Member
    Posted 1 year ago #

    wp_get_attachment_thumb_file would not return the file path. I patched wp-includes/post.php function wp_get_attachment_thumb_file and now it seems to be working.

    Existing code in function:

    if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) )return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );

    New code in function:

    if ( !empty($imagedata['sizes']['thumbnail']['file']) && ($thumbfile = str_replace(basename($file), $imagedata['sizes']['thumbnail']['file'], $file)) && file_exists($thumbfile) )return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );

  2. egado
    Member
    Posted 1 year ago #

  3. frankindelicato
    Member
    Posted 1 year ago #

    I dont understand your question. wp_get_attachment_thumb_url returns the http url wp_get_attachment_thumb_file returns the file path on the server. Is that what you are asking?

  4. egado
    Member
    Posted 1 year ago #

    Oh, ok thank you for the advice :) This is a big difference :)

Topic Closed

This topic has been closed to new replies.

About this Topic