31 May

ACF Chat Fridays: Options Pages in the UI and Bidirectional Relationships Coming in 6.2

By Mike Davey

ACF Chat Fridays offer an incredible opportunity to meet with other users and the ACF development team. Each session answers your questions about the best way to build WordPress sites with ACF, and provides insight into new features coming to the plugin.

The May 26th session featured a look at a new feature coming in ACF PRO 6.2: the ability to add options pages directly within the plugin’s UI.

Co-hosted by Iain Poulson, Matt Shaw, and Anthony Burchell.

Sign up for the next session →

ACF Chat Fridays Banner Image.

Session Recording

You can watch the entire session in the player below, or read on for a selection of session highlights.

Session Summary

Matt Shaw got the session started with a demo previewing the new features coming to options pages in ACF 6.2.

Creating a new options page only requires three pieces of information: title, slug, and a parent page. Toggling on “Advanced Configuration” provides access to all of the settings offered by ACF’s option pages. For example, you can change the menu title and position, customize the labels for the update button and the updated message, add custom permissions, and change where the options pages are saved, and control autoload options.

Bringing options pages into the UI makes it much easier to add field groups. Once you’ve created the options page in the UI, it provides the option to add fields to the page you’ve just created, or link existing field groups.

Because you’re creating the options page in the ACF PRO UI, you can export the local.json, allowing you to sync your options pages between different sites or put them in version control. You can also export them to PHP if you want to get them out of the UI.

The session also included a discussion of other new features currently in development. A future release of ACF will see a way to activate bidirectional relationships from within the UI when creating a Relationship field. Saving a relationship from one post object to another will automatically it on the other object, creating the relationship in both directions.

We’re also improving the UI for taxonomy-based conditional logic. For example, say you’re using a taxonomy or field, and you want to include conditional logic that shows another field based on the value that’s selected for the taxonomy. Currently, you can’t do that very easily in the UI, as you have to know the term ID that you want to target for the taxonomy. A future version of ACF will include an update to the conditional logic section of the field group editor that gives you a dropdown with the available categories. For example, if you’re selecting from “Users”, you’ll get a dropdown of the users, rather than having to guess at their IDs.

Last but not least, a future release will offer multiple json paths. Currently, ACF’s local JSON feature will load and save your field group, post type, and taxonomy definitions in a file for version control. However, that JSON is only loaded from one location and doesn’t allow for it to be saved in multiple locations.

For example, say you have a plugin that adds a field group your content editors need. The plugin has the JSON for the field group definition, but it’s not easy to tell ACF that it needs to pick up not only the JSON from the theme, but from the plugin as well. We’re adding support for filtering the paths for where the JSON files are acquired from and saved back to.

ACF Chat Fridays is going on a short hiatus for the next few weeks, but we’ll be back with our next session on June 23rd. As always, please feel free to reach out to us on Twitter.

You can also connect with Iain or Liam at WordCamp Europe, taking place June 8 to 10 in Athens, Greece. General admission tickets for WordCamp Europe were still available at the time of publication.

.

Q&A

Every ACF Chat Friday gives you the opportunity to ask the ACF team questions about technical challenges and the best way to achieve a specific objective. We’ve included just a few of the questions and answers below. Minor edits have been made for clarity and style.

Q: Is there any way to save ACF option pages more efficiently? Right now, it creates a lot of individual MySQL queries when you get them, even if you put them in something like a group field. No matter how you structure them, it doesn’t seem like there’s a singular query to get them out.

A: Turning on the autoload option might solve this. Essentially, autoload means that WordPress goes and grabs all of the options that are sent and puts them into memory. Currently, you’ll need to add some code to the options page to turn on autoload:

$option_page = acf_add_options_page( array(
    'page_title'    => __( 'Theme General Settings '),
    'autoload' => true,
));

Starting in ACF PRO 6.2, the UI panel for options pages will expose every argument that could be passed to that function. This will help shine a light on features that may have gone missed, such as autoload.

Q: Have you been exploring a Block Editor field? I’m thinking of something similar to the Wysiwyg Editor field, but for blocks.

A: We are currently looking at ways to achieve this. In the meantime, you might want to take a look at the Block Editor field offered in ACF Extended.

The next session of ACF Chat Fridays is scheduled for June 23rd, 2023, at 2pm GMT.

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

Join us on June 23rd for the next session of ACF Chat Fridays. This session will take place at 2pm GMT.

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

Sign up for the next session of ACF Chat Fridays here:

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

The list of upcoming sessions is below.

  • June 23, 2023
  • July 7, 2023
  • July 21, 2023
  • August 4, 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