Inserting common HTML in all forms

By: Luis Velásquez | Asked: 02/15/2024
ForumsCategory: Code HelpInserting common HTML in all forms
Luis Velásquez asked 3 months ago
Hi. I want to show the following text at the bottom of every form.
By submitting this form, you agree to our privacy policy.
Is there a way to do it once? That way we won't forget to add it in the future.
2 Answers
Best Answer
Luis Velásquez answered 3 months ago

For future devs, I solved it with this hook: add_filter('frm_filter_final_form'function ($html) { return $html . ' <a href="#">privacy policy</a>.'; }, 10);

 
Victor Font replied 3 months ago

Good solution Luis! Nice job!

Victor Font answered 3 months ago
You can create a form with just the agreement and add it to each of your forms as an embedded form. There's no way to add it automatically to each form, but with an embedded form, you build it once, and reuse it. Embedded forms are reusable components.
Luis Velásquez replied 3 months ago

<p>I found the frm_filter_final_form hook. Looks like what I was looking for, as users won't accidentally forget to add it.</p><p>Do you have an opinion on this approach?</p>

Making the Best WordPress Plugin even better - Together

Take on bigger projects with confidence knowing you have access to an entire community of Formidable Experts and Professionals who have your back when the going gets tough. You got this!
Join the community
crossarrow-right