Support

Account

Home Forums Bug Reports [5.0.6] Missing fields in get_fields($post_id);

Solving

[5.0.6] Missing fields in get_fields($post_id);

  • I am having a issue in ACF PRO 5.0.6. When trying to get all fields with: get_fields($post_id);

    I have setup a Flexible content element, which contains currently one layout named content_block.
    The layout contains 7 fields but when requesting all layouts/fields with get_fields($post_id) I only get 5.

    Current result of one Flexible content element:

    Array
    (
        [acf_fc_layout] => content_block
        [classes] => 
        [background_color] => 
        [background_image] => 
        [background_fixed] => 
        [title] => 
    )

    Expected result:

    Array
    (
        [acf_fc_layout] => content_block
        [classes] => 
        [background_color] => 
        [background_image] => 
        [background_fixed] => 
        [title] => 
        [content] =>
        [test] =>
    )

    Tried recreating the fields and resaving multiple times with no success.

  • Did another small test

    while ( has_sub_field('blocks') ) :
    	print_r(get_sub_field('title'));
    	print_r(get_sub_field('content'));
    
    endwhile;

    Shows only the title.
    While using
    get_post_meta($post->ID)

    Shows the content key in the array

        [blocks_0_content] => Array
            (
                [0] => Bla bla bla
            )
    
        [_blocks_0_content] => Array
            (
                [0] => field_53fc61e4d4240
            )
  • Another thing I noticed that tabs still show up as an empty key:

    [custom_fields] => Array
            (
                [blocks] => Array
                    (
                        [0] => Array
                            (
                                [acf_fc_layout] => content_block
                                [] => 
                                [title] => This is the title
                                [content] => This is the content
                                [fixed_bg] => 1
                            )
    
                    )
    
            )

    Not sure if this has anything to do with it, since we are using multiple tabs… wp_cache_get sets the found to true, while the result is empty (api-field.php line 454)

  • I also have this problem. The last few items always disappear. If I reorder, the new last items have disappeared.

    Edit:
    Noticed that this happens for me when I use tabs in a Flexible Content field.

  • I have the same issue.

    get_fields() does not return all fields. I tried to add new ones and see if they work and they don’t.

    get_field(‘the_field’) is working though…
    I just wonder why the get_fields() is bugged for this particular post. Because this get_fields() is used on a single_[post_type] and all other posts are working fine.

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

The topic ‘[5.0.6] Missing fields in get_fields($post_id);’ is closed to new replies.