• I just installed this plugin today and I am very happy with it. My question is, is there a way to populate the attributes such as alternate text, caption, and description when the file is placed in the media library? I have added fields to my contact form to capture this data, but I have not seen a way to apply it.

    Thanks again for a great plugin.

    Mark

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author mirceatm

    (@mirceatm)

    Hi!
    Caption and description could be set by changing $attachment array received by subscribing to nmr_before_insert_attachment filter – available from plugin version 1.2.2. See wp_insert_attachment for more details

    Alternate text could be changed once you get the attachment id by listening for nmr_create_attachment_id_generated action like below (code not tested):

    function example_callback_id_generated( $attachment_id ) {
        // update alt text
        update_post_meta($attachment_id, '_wp_attachment_image_alt', 'My Alt Text');
    }
    add_action( 'nmr_create_attachment_id_generated', 'example_callback_id_generated', 10, 1 );
    • This reply was modified 2 years, 8 months ago by mirceatm.
    Thread Starter beachman14

    (@beachman14)

    Thank you! I will give that a try.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Uploaded file attributes’ is closed to new replies.