Docs & Support

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

rest_prepare_frm_[action]

Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

This hook can be used to filter the data response object.

Usage

add_filter( 'rest_prepare_frm_[action]', 'change_item_name' );

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

Parameters

  • $data (object)
  • $item (object)
  • $request (array)

Examples

Change item name

This example will change the item name for the data response object

add_filter( 'rest_prepare_frm_entries', 'change_item_name', 10, 3 );
function change_item_name( $response, $item, $request ) {
    if ( isset( $response->data['name'] ) ) {
        $response->data['name'] = 'place here the new name of the item';
    }
    return $response;
}

Change field name

This example will change the field name for the data response object.

add_filter( 'rest_prepare_frm_fields', 'change_field_name', 10, 3 );
function change_field_name( $response, $field, $request ) {
    if ( isset( $response->data['name'] ) ) {
        $response->data['name'] = 'place here the new name of the field';
    }
    return $response;
}

Change form name

This example will change the form name for the data response object.

add_filter( 'rest_prepare_frm_forms', 'change_form_name', 10, 3 );
function change_form_name( $response, $form, $request ) {
    if ( isset( $response->data['name'] ) ) {
        $response->data['name'] = 'place here the new name of the form';
    }
    return $response;
}

Converts a specific meta key to an integer

This example will allow you to convert a specific meta key to an integer.

add_filter( 'rest_prepare_frm_entries', 'my_custom_function' );
function my_custom_function( $response ) {
	$meta_key = '5a4m0'; // change this to the meta key that needs to be converted to an integer.
	
	if ( isset( $response->data ) && ! empty( $response->data['meta'] ) && isset( $response->data['meta'][ $meta_key ] ) ) {
		$response->data['meta'][ $meta_key ] = (int) $response->data['meta'][ $meta_key ];
	}

	return $response;
}
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.

    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms