Advanced Post Creation Feed Meta

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

PropertyTypeDescription
feedNamestringA unique name for the feed.
actionstringSpecifies the action to perform: ‘post-create’ or ‘post-update’.
postVisibilitystringDefines the post’s visibility: ‘public’, ‘private’, or ‘password-protected’.
postTypestringThe post type, such as ‘post’, ‘page’, or a custom post type.
postStatusstringDefines the post’s status, e.g., ‘publish’, ‘draft’, or a custom status.
postDatestringSpecifies the source for the post date: ‘entry’, ‘custom’, or ‘field’.
postDateFieldDatestringThe field ID to use for the custom date, if applicable.
postDateFieldTimestringThe field ID to use for the custom time, if applicable.
postDateCustomstringA custom date value for the post, if applicable.
postAuthorstringDefines the post author: ‘logged-in-user’, ‘admin’, or a specific user ID.
postCommentsbooleanDetermines if comments are allowed: true (1) or false (0).
postPingbacksbooleanDetermines if pingbacks are allowed: true (1) or false (0).
postTitlestringThe merge tag or field value to use for the post title.
postContentstringThe merge tag or field value to use for the post content.
postMetaFieldsarrayAn array of custom post meta fields to map to form field values.
postTaxonomy_categoryarrayAn array mapping categories to form field values or custom terms.
postTaxonomy_post_tagarrayAn array mapping tags to form field values or custom terms.
feed_condition_conditional_logic_objectarrayStores conditional logic rules to determine when the feed should run.
feed_condition_conditional_logicbooleanDetermines if conditional logic is enabled: true (1) or false (0).
postDiscussionstringAdditional discussion-related settings for the post.
feedConditionbooleanEnables conditional logic to determine if the feed should run.