Introduction
The Feed Object meta for the Advanced Post Creation Add-on is an associative array containing the properties which determine how the add-on should process the form submission.
$feed['meta'] = array(
'feedName' => 'Post Creation Feed Example',
'action' => 'post-create',
'postVisibility' => 'public',
'postType' => 'post',
'postStatus' => 'publish',
'postDate' => 'entry',
'postDateFieldDate' => '',
'postDateFieldTime' => '',
'postDateCustom' => '',
'postAuthor' => 'logged-in-user',
'postComments' => '0',
'postPingbacks' => '0',
'postTitle' => '{Single Line Text A:1}',
'postContent' => '{Single Line Text B:3}',
'postMetaFields' => array(
array(
'key' => '', // Meta key.
'custom_key' => '',
'value' => '',
'custom_value' => '',
),
),
'postTaxonomy_category' => array(
array(
'key' => 'term',
'value' => 'parent',
'custom_value' => '',
),
),
'postTaxonomy_post_tag' => array(
array(
'key' => 'term',
'value' => 'gf_custom',
'custom_value' => 'Test',
),
),
'feed_condition_conditional_logic_object' => array(
'conditionalLogic' => array(
'actionType' => 'show',
'logicType' => 'all',
'rules' => array(
array(
'fieldId' => '1',
'operator' => 'is',
'value' => '1',
),
),
),
),
'feed_condition_conditional_logic' => '1',
'postDiscussion' => '',
'feedCondition' => '',
);
Usage
We recommend accessing the $feed meta using the rgar() or rgars() functions, e.g.:
$conditional_logic_enabled = rgars( $feed, 'meta/feedCondition' );
if ( $conditional_logic_enabled ) {
// Conditional logic is enabled for this feed.
$logic_rules = rgars( $feed, 'meta/feed_condition_conditional_logic_object/conditionalLogic/rules' );
foreach ( $logic_rules as $rule ) {
// Process each conditional logic rule.
$field_id = rgar( $rule, 'fieldId' );
$operator = rgar( $rule, 'operator' );
$value = rgar( $rule, 'value' );
// Example: Use $field_id, $operator, and $value in your logic.
}
}
Properties
Property | Type | Description |
---|---|---|
feedName | string | A unique name for the feed. |
action | string | Specifies the action to perform: ‘post-create’ or ‘post-update’. |
postVisibility | string | Defines the post’s visibility: ‘public’, ‘private’, or ‘password-protected’. |
postType | string | The post type, such as ‘post’, ‘page’, or a custom post type. |
postStatus | string | Defines the post’s status, e.g., ‘publish’, ‘draft’, or a custom status. |
postDate | string | Specifies the source for the post date: ‘entry’, ‘custom’, or ‘field’. |
postDateFieldDate | string | The field ID to use for the custom date, if applicable. |
postDateFieldTime | string | The field ID to use for the custom time, if applicable. |
postDateCustom | string | A custom date value for the post, if applicable. |
postAuthor | string | Defines the post author: ‘logged-in-user’, ‘admin’, or a specific user ID. |
postComments | boolean | Determines if comments are allowed: true (1) or false (0). |
postPingbacks | boolean | Determines if pingbacks are allowed: true (1) or false (0). |
postTitle | string | The merge tag or field value to use for the post title. |
postContent | string | The merge tag or field value to use for the post content. |
postMetaFields | array | An array of custom post meta fields to map to form field values. |
postTaxonomy_category | array | An array mapping categories to form field values or custom terms. |
postTaxonomy_post_tag | array | An array mapping tags to form field values or custom terms. |
feed_condition_conditional_logic_object | array | Stores conditional logic rules to determine when the feed should run. |
feed_condition_conditional_logic | boolean | Determines if conditional logic is enabled: true (1) or false (0). |
postDiscussion | string | Additional discussion-related settings for the post. |
feedCondition | boolean | Enables conditional logic to determine if the feed should run. |