add_attachment in not working with wp_get_attachment_image_src
-
This code is not working
add_action('add_attachment', 'example_file_added'); function example_file_added( $attachment_id ) { $attachments = wp_get_attachment_image_src($attachment_id,"medium"); var_dump($attachments); }
**return:** Not good (because attachment not medium link)
array(4) { [0]=> string(63) "https://example.com/wp-content/uploads/2015/09/example.jpg" [1]=> int(1) [2]=> int(1) [3]=> bool(false) }
is not medium link, in my opinion this bug..
**********************
But this is working with edit_attachment…
add_action('edit_attachment', 'example_file_edit'); function example_file_edit( $attachment_id ) { $attachments = wp_get_attachment_image_src($attachment_id,"medium"); var_dump($attachments); }
**return:** Is good (because medium link)
array(4) { [0]=> string(63) "https://example.com/wp-content/uploads/2015/09/example-500x400.jpg" [1]=> int(500) [2]=> int(400) [3]=> bool(514145) }
- The topic ‘add_attachment in not working with wp_get_attachment_image_src’ is closed to new replies.