Support

Account

Forum Replies Created

  • Thanks,

    but unfortunately this didn’t help. ID is correct, field is a basic top-level text field and field key is legit as well!

    wp_cache_delete() shouldn’t solve anything anyway when adding a new post right?

  • Hey!

    Typo, sorry. It’s update_field() of course and I’m setting basic text field value, so it’s a string.

    Really at a loss here after a few hours of digging around 🙂

    So, to write it down further (perhaps I find something odd now that I write it for someone else):

    $email = get_field($fields['org_email'], $ID); // $ID here is OK (printed in email that is sent)

    $fields is and array with field_id => field_key value pairs. This also seems to be working because a new post is added with the data via update_field() functions.

    And post is initially added like this:

    $post_id = wp_insert_post(
       array (
           'post_type' => 'my_post_type',
           'post_title' => 'Dynamic Name here',
           'post_status' => 'pending',
       )
    );
    
    // check if basic insertion was successful
    if( ! is_numeric($post_id)) {
        return false;
    } else { 
            
    $fields = lpml_get_acf_fields_key_name_map(); // this is field id => key value pair array
    
    update_field($fields['org_email'], $params_array['org_email'], $post_id); 

    This saves the data properly and all, except when I want to get the data via

    transition_post_status

    action it’s empty (empty string it seems). Is it to early to get this data here?

    When using ‘pending_to_publish’ hook for example, data is available …

    Is it possible, that values are not properly received because the post prior to this was still “pending” ? When I call update_field() the post was first inserted via wp_insert_post with the “status” => “pending”.

  • Hello.

    I have a similar problem with ACFPro (but not with subfield): when adding a custom post type with wp_insert_post() (with status “PENDING”!) and then calling multiple

    update_field('field_key','value', $post_id).

    I have a ‘transition_post_status’ hook that sends email when post just became “new” -> “pending”. But here,
    get_field('field_key', $ID);
    returns empty string (even if I use field id instead of key)!

    Any ideas / suggestions?

    Thanks!

  • Hey @hube2 can you please update the link with the working one, would be lovely to have a solution.

    thanks.

  • @jacobnollette’s solution worked for me! (wp_options table, option_name column -> increase length from 64 to something else, like 255). YAY

  • +1 for this! You can for instance remove “add media” buttons, but not using acf_form ?

    function mytheme_RemoveAddMediaButtonsForNonAdmins()
    {

    remove_action( ‘media_buttons’, ‘media_buttons’ );

    }
    add_action(‘admin_head’, ‘mytheme_RemoveAddMediaButtonsForNonAdmins’);

  • Ahh, I have the exact same issue. How to provide the featured image via acf_form ? Do I have to create a separate input element just for that and disable form and wrap it in my own? That seems tedious at best …

    Did you figure this out perhaps?

  • Same for me, cannot save – it goes to 404. Only on options pages, and only on production site. Working fine on development server and locally.

    It might be an issue with WP 4.1.2 or ACF 5.2.3, locally I see I still don’t have the new version of those two.

    Would love a solution!

  • +1 to make this work. Would absolutely love this feature! 🙂

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