Forum Replies Created

Viewing 1 replies (of 1 total)
  • mjd2

    (@mjd2)

    Hello shnalla,

    I really love this idea but I am a little confused.

    After adding the code you suggested into my theme’s function.php, it won’t give me an error but it also doesn’t attach any Tags. Any help would be much appreciated.

    Code in functions.php:

    <?php
    // Custom action to do any additional logic after attachment is uploaded
    	function my_fu_after_upload( $media_ids, $success ) {
    		// Iterate array with attachment ids
    		foreach( (array) $media_ids as $media_id ) {
    
    			// Term is just an example, all $_POST variables should be available to you
    			$term = sanitize_text_field( $_POST['post_tags'] );
    
    			wp_set_object_terms( $media_id, $term, 'imagetype', true );
    		}
    	}
    add_action( 'fu_after_upload', 'my_fu_after_upload', 10, 2 );
    ?>

    Shortcode on page:

    [fu-upload-form form_layout="post_image" category="7" title="Submit Content"]
    [input type="text" name="post_tags" id="ug_tags" description="Tags" multiple=""]
    [/fu-upload-form]

Viewing 1 replies (of 1 total)