Undefined index error
-
Hi Justin.
With
WP_DEBUGset totrue, I get the following error when callingget_the_imagewith 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 181The 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'.
The topic ‘Undefined index error’ is closed to new replies.