Media File Manager
Actions
add_action( 'stm_lms_media_library_upload_image', 'stm_lms_media_library_upload_image_function', 10, 1 );
function stm_lms_media_library_upload_image_function( $attachment_id ) {
$response = wp_remote_post(
'https://demo-website.com/',
array( 'body' => 'Image with ID ' . $attachment_id . ' has been uploaded.' )
);
$body = wp_remote_retrieve_body( $response );
if ( is_wp_error( $response ) || is_wp_error( $body ) ) {
$errors[] = 'There was an error occurred after sending a request';
return $errors;
}
}Last updated
Was this helpful?

