• Resolved mungbean

    (@mungbean)


    Hi there,

    I’d like to collect tags from the form that will be mapped to a post field (create post). I’d like to limit the number of tags, and perhaps have autocomplete to avoid duplicates.

    Is there a tag field or tag capability currently? Can I set a maximum? With autocomplete?

    Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @mungbean

    I hope you are doing good today.

    When you enable tags in postdata field it allows only to add tag as select or tags as checkboxes (you can switch that in the Settings tab of postdata field). It does not allow to end users to type tags manually. With that, there is no way to have duplicates as the end user will be able to select only 1 time specific tag.

    As for limits, I asked our SLS Team to see if this will be possible via some snippet. We will post an update here as soon as more information is available.

    Kind Regards,
    Kris

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi again @mungbean

    This snippet should help. 152, 86 are the tag IDs. You can add more tag IDs(comma-separated) to display on the postdata form.

    add_filter( 'forminator_field_postdata_post_tag_list', function( $tags ){
    	$only_tag_ids = [
    		152,
    		86
    	];
    	foreach( $tags as $id => $cat ){
    		if( ! in_array( $cat->term_id, $only_tag_ids ) ){
    			unset( $tags[ $id ] );
    		}
    	}
    	return $tags;
    } );

    You can add the above snippet as a mu-plugins. Please check this link on how to implement the above code as a mu-plugins:

    Must Use Plugins

    Kris

    Plugin Support Kasia – WPMU DEV Support

    (@wpmudev-support2)

    Hello @mungbean ,

    We haven’t heard from you for over a week now, so it looks like you don’t need our assistance anymore.

    Feel free to re-open this ticket if needed.

    Kind regards
    Kasia

    Thread Starter mungbean

    (@mungbean)

    Thanks, Kasia. I will look into this and mu-plugin.

    Are there plans to implement the tag limit into the plugin?

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @mungbean

    I hope you are doing well.

    I can see we do have plans to extend the post field but we don’t have an estimated time for it.

    You can subscribe to our roadmap at: https://wpmudev.com/roadmap/#forminator

    Best Regards
    Patrick Freitas

Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.