WordPress.org

Ready to get started?Download WordPress

Forums

Get the Image
Undefined index error (1 post)

  1. viniciusmassuchetto
    Member
    Posted 1 year ago #

    Hi Justin.

    With WP_DEBUG set to true, I get the following error when calling get_the_image with these parameters:

    $img = get_the_image( array(
        'post_id' => $post->ID,
        'size' => $size,
        'attachment' => true,
        'image_scan' => true,
        'echo' => false,
        'format' => 'array',
        'default' => $default
    ) );
    Notice: Undefined index: src in [...]/wp-content/plugins/get-the-image/get-the-image.php on line 181

    The notice complains about this line:

    $out['url'] = $out['src']; // @deprecated 0.5 Use 'src' instead of 'url'.

    Verifying the attribution like this solved my problem:

    $out['url'] = !empty( $out['src'] ) ? $out['src'] : false; // @deprecated 0.5 Use 'src' instead of 'url'.

    http://wordpress.org/extend/plugins/get-the-image/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

  • RSS feed for this topic
  • Started 1 year ago by viniciusmassuchetto
  • This topic is not a support question
  • WordPress version: 3.5