• Resolved jeynon

    (@jeynon)


    Hi all,

    So I am accessing the font awesome field that is in a repeater. I am accessing this data in a loop via a get_post_meta.

    $sub_field_value_icon = get_post_meta(get_sub_field(“person”), $meta_key_icon, true);

    This returns me the object and not the element as I have selected in the settings in ACF. Regardless of what I change that to, I keep getting the whole object, that looks like this on return.

    { “style” : “brands”, “id” : “linkedin”, “label” : “LinkedIn”, “unicode” : “f08c” }

    I have used the plugin many times and had no problem accessing the class but I have also done so in a CPT WP Query and not in the get_post_meta…

    What am I doing wrong here and how can I access the element. It looks like the class isn’t even in the object so I can’t even try and work with it.

    Thanks for the help!

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Matt Keys

    (@mattkeys)

    By using get_post_meta you are bypassing the ACF filters that control how the data is returned to you (based on your settings in the field).

    Those filters are run when you use get_field, get_sub_field, the_field, etc.

    get_post_meta will return the ‘raw’ data from the database with no filters applied.

    Thread Starter jeynon

    (@jeynon)

    Thanks for the heads up Matt. I will switch up my attack and use WP Query to access the filtered data.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_post_meta in a repeater is returning the object, not the class as expected’ is closed to new replies.