Support

Account

Home Forums ACF PRO get_field in an ACF block template vs. Flex Content

Unread

get_field in an ACF block template vs. Flex Content

  • I am wondering if ACF Blocks are more performant from the standpoint of database calls in my example below, with respect to the get_field function call.

    I have made a custom ACF block with a text field “headline” – in the block PHP file I am using get_field(“headline”) and then echoing the result. I also can see from var_export that there is an array called $block which has a key “data” that is itself an array of the ACF fields – i.e. I could also be echoing $block[“data”][“headline”] and not run get_field at all.

    First question – is there any difference in the above 2 methods – either get_field or getting the value out of the $block array?

    Second question – when using ACF blocks, is get_field in a block PHP template actually querying the database, or is it parsing the result of a query that has already happened in the PHP execution? In this way, is a page with multiple ACF blocks not adding any more database queries because the values of every field on every block was returned from the post_content column in the wp_posts table? Does this make blocks strictly more performant from a DB querying perspective than flexible content layouts?

    Thanks for any isnights

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.