Introduction
The following GFAPI methods are used to manage form Feeds. Each Feed contains the properties which determine if and how the form submission is processed by an add-on.
See the GFAPI article for other available methods.
get_feeds
GFAPI::get_feeds()
was added in Gravity Forms version 1.8, it is used to get all feeds which match the given search criteria.
public static function get_feeds( $feed_ids = null, $form_id = null, $addon_slug = null, $is_active = true ) {}
Parameters
- $feed_ids null|integer|array
Optional. The ID of the Feed or an array of Feed IDs.
- $form_ids null|string|array
Optional. The ID of the Form to which the Feeds belong. Since 2.6.1 an array of IDs can be used to return feeds for multiple forms.
- $addon_slug null|string
Optional. The slug of the add-on to which the Feeds belong, including the gravityforms prefix. See the Gravity Forms Add-On Slugs article for a list of possible slugs.
- $is_active boolean
Optional. Default true. Indicates if only active or inactive feeds should be returned. Since 2.4.23.4 null can be used to return both.
Returns
- $result array|WP_Error
An array of Feed Objects or a WP_Error instance.
Usage Examples
Getting all active feeds.
$result = GFAPI::get_feeds();
Getting a specific feed.
$result = GFAPI::get_feeds( 1 );
Getting multiple specific feeds.
$result = GFAPI::get_feeds( array( 1, 5 ) );
Getting all active feeds for a specific form.
$result = GFAPI::get_feeds( null, 2 );
Getting all active feeds for a specific add-on.
$result = GFAPI::get_feeds( null, null, 'gravityformszapier' );
get_feed
GFAPI::get_feed()
was added in Gravity Forms version 2.4.23.4, it is used to get a specific feed.
public static function get_feed( $feed_id ) {}
Parameters
- $feed_id integer
The ID of the feed to retrieve.
Returns
- $result array|WP_Error
The Feed Object or a WP_Error instance.
Usage Examples
$result = GFAPI::get_feed( 1 );
add_feed
GFAPI::add_feed()
was added in Gravity Forms version 1.8, it is used to add a new feed to the specified form with the given configuration.
public static function add_feed( $form_id, $feed_meta, $addon_slug ) {}
Parameters
- $form_id integer
The ID of the form to which the feed belongs.
- $feed_meta array
The feed properties, see the meta property of the Feed Object.
- $addon_slug string
The slug of the add-on to which the Feed belongs, including the gravityforms prefix. See the Gravity Forms Add-On Slugs article for a list of possible slugs.
Returns
- $result WP_Error|integer
A WP_Error if an error occurs or the ID of the Feed returned by the database.
Usage Examples
$result = GFAPI::add_feed( $form_id, $feed_meta, $addon_slug );
delete_feed
GFAPI::delete_feed()
was added in Gravity Forms version 1.8, it is used to delete a specific Feed.
public static function delete_feed( $feed_id ) {}
Parameters
- $feed_id integer
The ID of the Feed Object to be deleted.
Returns
Usage Examples
$result = GFAPI::delete_feed( $feed_id );
update_feed
GFAPI::update_feed()
was added in Gravity Forms version 1.8, it is used to update the meta for a specific Feed.
public static function update_feed( $feed_id, $feed_meta, $form_id = null ) {}
Parameters
- $feed_id integer
The ID of the Feed Object to be updated.
- $feed_meta array
The feed properties, see the meta property of the Feed Object.
- $form_id integer
The ID of the form to which the feed belongs.
Returns
Usage Examples
$result = GFAPI::update_feed( $feed_id, $feed_meta, $form_id );
feed_exists
GFAPI::feed_exists()
was added in Gravity Forms version 2.4.24, it is used to check if a Feed exists for the given ID.
public static function feed_exists( $feed_id ) {}
Parameters
- $feed_id integer
The ID to be checked.
Returns
- $result boolean
Whether or not a Feed Object exists for the supplied ID.
Usage Examples
$result = GFAPI::feed_exists( $feed_id );
update_feed_property
GFAPI::update_feed_property()
was added in Gravity Forms version 2.4.24, it is used to update the properties of a specific Feed.
public static function update_feed_property( $feed_id, $property_name, $property_value ) {}
Parameters
- $feed_id integer
The ID of the Feed Object to be updated.
- $property_name string
The name of the property (column) being updated. Supported: form_id, is_active, feed_order, meta, and addon_slug
- $property_value string|integer|array
The new value of the specified property. The meta property can be passed as an associative array or JSON.
Returns
Usage Examples
$result = GFAPI::update_feed_property( $feed_id, $property_name, $property_value );
$result = GFAPI::update_feed_property( 1, 'is_active', 0 );