Support

Account

Home Forums General Issues URGENT: ACF PRO can't get post_title value + No answer from support since one w

Helping

URGENT: ACF PRO can't get post_title value + No answer from support since one w

  • I tried to create a new post using front end form, everything work exempt that I can’t get post title field value or post content field value πŸ™
    here is my code in the template page file:

    function add_person( $post_id )
    {
    // check if this is to be a new post
    if( $post_id != ‘new’ )
    {
    return $post_id;
    }
    var_dump($POST);

    // Create a new post
    $post = array(
    ‘post_status’ => ‘publish’ ,
    ‘post_type’ => ‘company’ ,
    ‘post_title’ => $_POST[‘acf’][“acf[_post_title]”],
    ‘post_content’ => $_POST[‘acf’][“acf[_post_content]”]
    );

    // insert the post
    $post_id = wp_insert_post( $post );

    // update $_POST[‘return’]
    $_POST[‘return’] = add_query_arg( array(‘post_id’ => $post_id), $_POST[‘return’] );
    // return the new ID
    return $post_id;

    }

    add_filter(‘acf/pre_save_post’ , ‘add_person’ );
    acf_form_head();
    β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
    <?php

    $args = array(
    ‘post_id’ => ‘new’,
    ‘field_groups’ => array(24),
    ‘post_title’ => true,
    ‘post_content’ => true
    );

    acf_form( $args );

    ?>

    when I vardump the $POST variable I get NULL

    ——————————————–

    Also I didn’t understand how to utilise functions like “function add_person( $post_id ) Β» in function.php how to add several functions like this one ?
    ex: – function add_person( $post_id )
    – function add_company( $post_id )
    – function add_product( $post_id )
    and how to setup my template files so they know which function they have to use according to the post type they are supposed to create ?

    Thank you very much for your help

    ——————–

    Hello, I’m currently disapointed by the support of the plugin and its lake of documentation, how to have informations to use the plugin properly ?

    screenshot

    Thank you

  • I would love to help you but at the same time I would hate to disagree with you that support ACF folks provide is not good. I think they are trying their best to accommodate everyone.

    I dont know though, why you haven’t been answered yet, but I can say for sure that your question is very confusing from start to the end.

    I would like to help you out but I have few questions;

    1. What are you using ACF for?
    2. What type of fields are you using, and what are the field names.
    3. If you are using custom post type and cant see your fields?
    4. Are you having problem outputting the fields data?

    May be you can share few screenshots/urls to understand better your problem.

    Thanks

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.