Created
October 2, 2019 10:33
-
-
Save polevaultweb/e7dcad42f77de5ddc6a1b2cbec1c6e47 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 ); | |
} |
Save this file to your /wp-content/mu-plugins/ directory (you might need to create the mu-plugins directory).
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm having the same problem trying to import files into ACF gallery from Ninja forms. Where would I need to place this code in order to make it work, please. Would hugely appreciate your help on this.