1

I always see these on my dashboard

Notice: Undefined index: full in /home2/guyfancy/public_html/cafe4apps.net/wp-includes/media.php on line 215

Notice: Undefined index: full in /home2/guyfancy/public_html/cafe4apps.net/wp-includes/media.php on line 216

Notice: Undefined index: full in /home2/guyfancy/public_html/cafe4apps.net/wp-includes/media.php on line 217

Notice: Undefined index: full in /home2/guyfancy/public_html/cafe4apps.net/wp-includes/media.php on And recently it started showing up in front end as well

  • Disable plugins and switch to one of the included themes to see if the error persists. I'll guess that a plugin or your theme is doing something strange. You should also disable debugging on a live site so visitors don't see error messages, which can reveal sensitive information. – Milo May 27 '17 at 2:24
  • have you the last version of WordPress ? – mmm May 27 '17 at 18:59
  • I've turned off the WP_DEBUG, but those errors still persisted. Please I need to hide the errors from users. Help? – user166415 May 28 '17 at 6:29
  • Imho it is wise to find some help (from someone with more then 'just basic' knowledge) because how to say it polite..ehm .. it could be faster cleaner and oh dear... take a look here yourself. About preventing the notices to be shown, maybe reading this and/or this would help to understand a little more about debug. – Charles May 28 '17 at 23:04
  • Bless you, you've been most helpful – user166415 May 29 '17 at 4:43
1

For anyone else who stumbles on this problem I've found a possible cause.

When you're running wp_get_attachment_image_src($imageid,'full') in your code if the $imageid you're checking doesn't have a 'full' size available you will see this error.

As suggested above this particular problem could be caused by a plugin not checking for the existance of an image size before requesting it. If you wanted something more specific you could run a search for wp_get_attachment_image_src in your plugins and theme to see if anything is trying to get the 'full' image without checking for it's existance yet.

In my case it was custom code so I wrote this to get around it

$meta = wp_get_attachment_metadata($imageid);   
if( array_key_exists("full", $meta["sizes"]) ) {
   $imagepath = wp_get_attachment_image_src($imageid,'full')
} else {
  // Fallback to the original file name
  if( array_key_exists("file", $meta) )
     $imagepath = 'wp-content/uploads/' . $meta["file"];
}
  • Make sure to properly document this inline at the code snippet ;) – kaiser Aug 23 '17 at 5:35
  • Yes of course! I was lucky, it was my own stupid code so I could fix it and document it there :) – Sean Morrison Aug 24 '17 at 1:12
0

There really wasn't a question in there so I'm not sure which route you're trying to go so here's a little troubleshooting for you...

First, before we look at resolutions, it is never a good idea to leave debug on a production server. You shouldn't be seeing those error messages because they're not mission critical and wouldn't stop the display of your site.

  1. If you're not running the most recent versions of WordPress and your plugins/themes, make a site backup and then update those.

  2. If that doesn't work, my guess would be a theme is causing the issue. (Because it's the wp-includes/media.php file throwing the error, not a plugin) The easiest way to figure out if it is your theme is to activate another one.

  3. Finally, if you haven't gotten to the bottom of it by now, try moving all the plugin folders into a folder called .inactive (or something like that), visit your home page and see if it fixed it. If so, that is the problem. Start adding plugins back in until the error reappears, that will be the culprit. You can then move all the other plugins back in.

Once you're done troubleshooting, please make sure you change the 'true' in define('WP_DEBUG', true) to 'false'.

  • Hey, thanks for your answer. But I'm afraid I might mess things up if I try doing these things. Can you please help me out with it? – user166415 May 27 '17 at 16:54
  • I've changed the WP_DEBUG to false, and those things still appear. Anymore suggestions? – user166415 May 28 '17 at 6:26
0

I was getting this error when I learned I was supplying an image URL instead of the image ID. A stupid mistake on my end but it was not obvious.

Check to make sure you are passing a valid image ID to wp_get_attachment_image_src. There was no sign of error, but the URL it was returning was actually just the base upload directory and it threw the warning that was described above.

Of course if it isn't your code, it's a plugin or theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.