WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Custom Fields
Filling fields with Javascript (1 post)

  1. chriscatfr
    Member
    Posted 1 year ago #

    I'm using the latest version (ids has changed lately) 4.0.3.

    And I fill the custom fields automatically with Ajax.

    I add new posts with the following kind of URL
    /wp-admin/post-new.php?post_type=expert&question_id=83

    then AJAX load the custom fields values that I copy to their fields with the following JS:
    jQuery('#acf-field-email').val( question_array['email'] );

    It works fine, except that I can't find which Javascript function is used for Images. I have a custom field for an image, my ajax provide me with the ID and SRC for thumbnail.

    For dates I ended up using a text custom fields too. But it's not that disturbing.

    Could you tell me how to fill this image custom field please?
    <div id="acf-attached_file_id"...

    I wish I could use the following JS line:
    auto_insert_image( question_array['attached_file_id'], question_array['attached_file_src'] );

    http://wordpress.org/extend/plugins/advanced-custom-fields/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic