Support » Requests and Feedback » wp_generate_attachment_metadata return value on errors

  • Hello, in these days I worked with wp_generate_attachment_metadata function, it would be very useful if in case of some problems
    this function can return a WP_Error object and not an empty array.

    Example: if image doesn’t exists or if attachment mime type is missing and in many other situation when wp_generate_attachment_metadata can’t do its job, it simply fail returning an array without elements.

    What do you think about this?

Viewing 1 replies (of 1 total)
  • I found someone using this:

    $metadata = wp_generate_attachment_metadata( ID, $fullsizepath );
    if ( is_wp_error( $metadata ) )
    if ( empty( $metadata ))
    die (__( ‘Unknown failure reason.’));

    but it’s not documented that wp_generate_attachment_metadata can return a WP_error object…

Viewing 1 replies (of 1 total)
  • The topic ‘wp_generate_attachment_metadata return value on errors’ is closed to new replies.