Hi @artoftech,
The Forminator forms are meant for simple actions, I’m afraid, at the moment there isn’t any out-of-the-box feature to create post tags and it’ll require custom coding.
You could check whether using custom fields could help in such a workflow. You might find the following helpful using the ACF plugin:
https://support.advancedcustomfields.com/forums/topic/add-post-tags-from-custom-fields-value/
Kind Regards,
Nithin
Thread Starter
John
(@artoftech)
Hi, I found an article about adding categories that makes use of the “forminator_post_data_field_post_saved”
action.
Here is the code I wrote to create tags from a custom field:
add_action( ‘forminator_post_data_field_post_saved’, function( $post_id, $field, $data ) {
if($field[“options”][1][“label”] === ‘custom_tags’) {
$tags_val = $data[“post-custom”][1][“value”];
wp_set_post_terms( $post_id, $terms = $tags_val, $taxonomy = ‘post_tag’, $append = false );
}
}, 99, 3);
I am fairly new to WP PHP, and haven’t done any error trapping yet; so it probably isn’t super robust, but gives others a starting point if they are in need of this capability.
BTW-I couldn’t find a list of actions like this in the docs. Can you point me to a resource if it exists?
Thanks for your time and the excellent plugin!
Hi @artoftech
At the moment I’m afraid we only have the following docs in terms of API:
https://wpmudev.com/docs/api-plugin-development/forminator-api-docs/
Our team is already working on improving the documentation when it comes to hooks.
Kind Regards,
Kris