Support

Account

Home Forums Backend Issues (wp-admin) Update Post Meta & Image Field

Helping

Update Post Meta & Image Field

  • I’m creating my own frontend submission form (not using the one that comes with the plugin) I’ve managed to set a feature image from the frontend however i can’t manage to update the field value of the “Image Field” in the backend.

    Everything is set correctly, the image is also uploaded however it’s not passed to the field, is there any special thing that i need to do?

    Currently the function looks like this

    update_post_meta( self::$auto_id, 'additional_image_1', $values['media_fields']['additional_image_1'] );

    The image isn’t uploaded to the wp media manager but to another folder on the server, does it needs to be “handled” as a wp media image/attachment? Or i can set any url ?

    Currently the image is just uploaded on the server and not set as “media attachment” i can easily get the url if i pass it to a text field but it doesn’t update the image field even if i set the field to return the image url (into the acf setting page).

    Do i have to pass the image to the wp upload handler? Any clue?

    Thank you.

  • Hi @alexgold05

    Because ACF uses the native WP media library for it’s data, the uploaded image will need to be added to the media library so that it has an ID in the database.

    If you wish to use a url for the image and store it in a custom folder, just use a text field to hold the url instead of an image field. This will be the easiest solution.

    Thanks
    E

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Update Post Meta & Image Field’ is closed to new replies.