Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

formidable_shortcode_atts

Use custom parameters in the [formidable] shortcode.

Usage

add_action('formidable_shortcode_atts', 'formidable_shortcode_atts', 20, 2);
function formidable_shortcode_atts( $atts, $all_atts )

Parameters

  • $atts (array): The standard options in the formidable shortcode
  • $all_atts (array): All attributes included in the shortcode

Formidable Forms makes advanced site building simple. Launch forms, directories, dashboards, and custom WordPress apps faster than ever before.

Examples

Disable readonly for Admins

Mark the fields read only in your field settings like normal, and then conditionally disable it with this function. Include readonly='administrator' in your [formidable] shortcode, and use this example to process it.

add_action('formidable_shortcode_atts', 'frm_admin_readonly', 20, 2);
function frm_admin_readonly( $atts, $all_atts ) {
  if ( $atts['readonly'] == 'administrator' ) {
    global $frm_vars;
    if ( current_user_can('administrator') ) {
      $frm_vars['readonly'] = 'disabled';
    } else {
      $frm_vars['readonly'] = false;
    }
  }
}

Change style template based on parameter

If you have the same form published in multiple locations and you want to have different styles, you can use this example. When publishing the form, use the shortcode: Please select a valid form Replace "formidable-style-7" with the style name, which you can find for the particular style under Formidable > Styles next to the "Style Name".

add_action( 'formidable_shortcode_atts', 'maybe_change_style_class', 10, 2 );
function maybe_change_style_class( $shortcode_atts, $atts ) {
	if ( isset( $atts['form_style'] ) ) {
		global $frm_atts;
		$frm_atts['switch_style'] = $atts['form_style'];
		add_filter( 'frm_add_form_style_class', 'change_style_class', 20 );
	}
}

function change_style_class( $class ) {
	global $frm_atts;

	if ( isset( $frm_atts['switch_style'] ) ) {
		$new_class = $frm_atts['switch_style'];
	  	$class = 'with_frm_style frm_style_' . $new_class;
	  	
		//reset for other forms
		unset( $frm_atts['switch_style'] );
		remove_filter( 'frm_add_form_style_class', 'change_style_class', 20 );
	}
	return $class;
}
Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2025 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Complete your purchase
    Special offer unlocked.
    Get 55% OFF!
    Complete Purchase
    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms