Title: Add new attribute to field
Last modified: December 14, 2017

---

# Add new attribute to field

 *  Resolved [cruiseback](https://wordpress.org/support/users/cruiseback/)
 * (@cruiseback)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/add-new-attribute-for/)
 * Tjena Fabian!
 * Thanks for this fantastic plugin! I am finally able to kill off Gravity Forms
   whichc is making our site slow to load because of this gem.
 * I have read through the documentation several times, especially this article:
   [https://advancedforms.github.io/filters/forms/af-form-field_attributes/](https://advancedforms.github.io/filters/forms/af-form-field_attributes/)
   but for the life of me I cannot make it work, adding an attribute to my <form
   > field.
 * Basically I just want to have “cf-form” added so that I can make this work with
   Conversational Forms from Space10 ([https://space10-community.github.io/conversational-form/](https://space10-community.github.io/conversational-form/)).
 * Right now I have:
    `<form class="af-form acf-form" method="POST" action="CURRENT_URL"
   id="form_5a2fb917a49ce">`
 * And I would like to end up with:
    `<form cf-form class="af-form acf-form" method
   ="POST" action="CURRENT_URL" id="form_5a2fb917a49ce">`
 * Can you help me with the relevant code to get this done?
 * Thanks again for a great plugin!
 * CB

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [fabianlindfors](https://wordpress.org/support/users/fabianlindfors/)
 * (@fabianlindfors)
 * [8 years, 8 months ago](https://wordpress.org/support/topic/add-new-attribute-for/#post-9784414)
 * Hallå!
 * Super glad to hear you’re enjoying AF. I made the plugin to replace the awful
   Gravity Forms in my day job and I’m happy others are able to as well.
 * The `af/form/field_attributes` is used to add attributes to individual fields
   of a form and not the form in itself.
 * Luckily there is actually a corresponding filter for the form element as well
   but I have yet to document it. The filter is `af/form/attributes` and can be 
   used something like this (untested):
 *     ```
       function add_form_class($atts, $form, $args) {
         $atts['cf-form'] = '';
         return $atts;
       }
       add_filter( 'af/form/attributes', 'add_form_class', 10, 3 );
       ```
   
 * I hope it works!
 *  Thread Starter [cruiseback](https://wordpress.org/support/users/cruiseback/)
 * (@cruiseback)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-new-attribute-for/#post-9802333)
 * Tackar! That worked a treat, GF have now been disabled, and what a joyful moment
   that was 🙂
 * CB
 *  Plugin Author [fabianlindfors](https://wordpress.org/support/users/fabianlindfors/)
 * (@fabianlindfors)
 * [8 years, 7 months ago](https://wordpress.org/support/topic/add-new-attribute-for/#post-9817787)
 * Glad to hear! Feel free to reach out if you have any other questions or problems.
 * God fortsättning!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Add new attribute to field’ is closed to new replies.

 * ![](https://ps.w.org/advanced-forms/assets/icon-256x256.png?rev=1894254)
 * [Advanced Forms for ACF](https://wordpress.org/plugins/advanced-forms/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-forms/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-forms/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-forms/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-forms/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-forms/reviews/)

## Tags

 * [attributes](https://wordpress.org/support/topic-tag/attributes/)

 * 3 replies
 * 2 participants
 * Last reply from: [fabianlindfors](https://wordpress.org/support/users/fabianlindfors/)
 * Last activity: [8 years, 7 months ago](https://wordpress.org/support/topic/add-new-attribute-for/#post-9817787)
 * Status: resolved