Using Gravity Forms to upload media into library, then attach to post
I have a simple site with two Gravity Forms, both of which allow users to upload media.
I’m looking for some simple code that:
(a) inserts all uploaded media into the Media Library and not the default Gravity Forms folder
(b) attaches media to pages. Form 1 attach to page 1, form 2 to page 2.
I’ve found a few similar posts, but nothing simple that does exactly what I need.
I guess I’d use something like
add_action( 'gform_after_submission_1', 'after_submission', 10, 2 );
Because I only have two forms, would something simple in the functions.php that adds media to the library then depending on which form was used attaches to posts work?