Created
October 2, 2019 10:33
-
-
Save polevaultweb/835431b40362d8e61ba7b25199496f10 to your computer and use it in GitHub Desktop.
Use Ninja Forms File Upload fields as the source of an ACF Gallery field, when using the Post Creation addon.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'ninja_forms_create_post_meta_value', 'my_ninja_forms_create_post_meta_value', 10, 3 ); | |
function my_ninja_forms_create_post_meta_value( $value, $post_type, $key ) { | |
if ( 'gallery' !== $key ) { // change this string to match your ACF field name | |
return $value; | |
} | |
return explode( ',', $value ); | |
} |
Hi there :) !
Little question: How can we map a NF upload field with single ACF Image field? Can't find how...
Thank you :)
@cedriccharles4 you would do it in the same was as described here
Thank you, I've achieved my goal ;)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the above file to the
wp-content/mu-plugins/
directory (create it if it doesn't exist).Insert the File Upload mergetag as the meta value in the NF Create Post action, then add
:attachment_id
to the end eg. {field:file_upload_241:attachment_id}