Hello,
Thanks for the feedback!
The {term} Template Tag in the ACFE Form should be used when the form is displayed on a Taxonomy Term page on the front-end. In your case, you’ll have to use the acfe/form/submit/post_args hook (See documentation) in order to retrieve the current post terms, and add it to the Post Title.
Here is a usage example:
add_filter('acfe/form/submit/post_args/form=my-form', 'my_form_post_args', 10, 4);
function my_form_post_args($args, $type, $form, $action){
// retrieve the current post id (where the form is being displayed)
$post_id = $form['post_id'];
// retrieve the field input value 'palyazo_nev'
$palyazo_nev = get_field('palyazo_nev');
// retrieve the current post title
$post_title = get_the_title($post_id);
// retrieve the current post category
$category = get_the_terms($post_id, 'category');
$category = array_shift($category);
// change the post title
$args['post_title'] = "{$palyazo_nev} - {$post_title} - {$category->name}";
// return
return $args;
}
Hope it helps!
Have a nice day!
Regards.
Hello!
Thank you, it was helpful.
I have one other problem.
I use two post action. I save the form’s datas to two CPT (for different purposes).
The my_form_post_args function is overwrite both post titles. But I would like to use it only for ‘palyazatok’.
Can you help me to achive this?
Hello,
Sorry for the late answer, but I didn’t see your reply earlier.
When using two Post Action within the same form, you should use hooks that target an Action Name. You can set the names in each Action. See screenshot.
Once the name is set, then you can use named hooks like that: acfe/form/submit/post/action=my-action.
Hope it helps!
Have a nice day!
Regards.