21 Feb

ACF Chat Fridays: February 17, 2023

By Mike Davey

ACF Chat Fridays are a unique opportunity to engage in live discussions with the ACF team and other users. Each session includes new information on building WordPress sites with ACF, what’s currently in development for the plugin, and the best ways to use the available fields.

Co-hosted by Iain Poulson, Liam Gladdy, Matt Shaw, Anthony Burchell, and John Parris.

Sign up for the next session →

ACF Chat Fridays Banner Image.

Summary

The latest session of ACF Chat Fridays took place on February 17, 2023. During the open forum, users took the opportunity to ask questions regarding how ACF handles data, the motivation behind bringing the ability to register CPTs to the plugin, possible plans to enhance how JavaScript dependencies are currently loaded, and much more.

The next session of ACF Chat Fridays is scheduled for March 3, 2023. Among other highlights, Liam Gladdy will present a demo on registering custom post types within Advanced Custom Fields.

One of the best things about these sessions is the chance to ask the ACF team questions about technical challenges and upcoming developments in a casual environment. Fully answering these questions often involves a lot of detailed discussion that we can’t fully reproduce here. Below you’ll find a selection of questions and answers from the session. Minor edits have been made for clarity and style.

Q: What’s the motivation for bringing native taxonomy/type registration to ACF when there are popular, well supported, free plugins that already do that?

A: We surveyed ACF users for the top three features they wanted to see, and this came pretty high on the list. There are a lot of people who want to register custom post types and custom taxonomies in ACF without having to rely on another plugin.

Q: When using ACF fields with ‘ui’ = true, the Select2 fires on every field, hidden or visible. It could run 200 or 300 times, even if the hidden fields means it only needs to run about 40 times. This can cause significant performance problems when we have a ton of fields that use ‘ui’ = true and Repeaters. I’m using ACF Blocks, so I can’t use pagination on the parent Repeater field. Is there a way to only initiate Select2 on visible fields? If not, is there another way to fix this?

A: As you mentioned, there’s no performance benefit to pagination when using ACF Blocks, as the meta data is stored in the block comment. We’ll want to take a deeper look at this and possibly make it an opt-in feature. In the meantime, using an InnerBlock instead of a Repeater field inside your block may help.

Q: When does ACF use JSON vs. using the database? Why does it save to the database and to JSON files? Do we still need this behavior?

A: With JSON, you don’t actually need to sync to the database, but it’s often handy to have it available. ACF will load from the JSON first when viewing posts or pages with field groups attached, and when calling things like get_field_object(). When viewing a field group in the field group editor, it will load from the database first, if you have the database synced. Then if you save a field group, it will sync it right back to the JSON file.

It’s faster in some situations to do it this way, but it’s definitely worth experimenting and seeing what fits your specific needs and use case.

Q: Are there any plans to enhance how JavaScript dependencies are loaded when ACF displays a form? There are some specific workarounds to this logic with the Google Map field, where the Google JavaScript is lazy-loaded. Is this something that we could see for other ¡Query libraries?

A: We’ve been making progress on JavaScript performance in each of our releases, as we know it can be a pain point with huge field groups or datasets. We’re hoping to be able to abstract more of our JavaScripts into separate files, so we can easily load just what is required for the page render. However, a lot of this work is dependent on a few upcoming WordPress core changes, as it will impact how we can implement this.

Resources & Links

We share relevant resources during the call. We’ll sum them up here and try to provide a bit of context:

Coming Up on ACF Chat Fridays

Make sure to join us on March 3rd for a live demo highlighting how registering custom post types and taxonomies will work in Advanced Custom Fields.

What else do you think we should cover in upcoming sessions? Let us know what you’d like to see on Twitter.

Sign up for upcoming ACF Chat Fridays here:

https://wpeng.in/acf-chat-fridays/

The list of upcoming sessions is below. Calls usually take place at 3pm GMT. The March 17th session takes place at 9pm GMT.

  • March 3, 2023
  • March 17, 2023
  • March 31, 2023
  • April 14, 2023

Tag or DM us on Twitter to let us know you’ll be there. Suggest new topics, let us know what you’d like to see, and send us feedback with #ACFChatFridays on Twitter.

About the Author