Questions tagged [advanced-custom-fields]

Advanced Custom Fields is a free WordPress plugin which acts as a GUI layer for custom fields. Custom fields are native to WP and appear on pages, posts and custom post types, however the native custom field interface is not very user friendly. ACF uses field groups to attach fields to edit screens.

Advanced Custom Fields is a free WordPress plugin which acts as a GUI layer for custom fields. Custom fields are native to WP and appear on pages, posts and custom post types, however, the native custom field interface is not very user-friendly. ACF uses field groups to attach fields to edit screens.

More information and good documentation are available on the official website. The plugin can be downloaded from the WordPress plugin repository or installed from within the WordPress admin.

Useful Links

4522 questions
9
votes
2 answers

Creating function to replace post title not working

I am trying to create a function inside functions.php to replace the custom post title with information from several custom fields. Before publishing the post, I want to evaluate if it is already created or if this is a new post; if it is a new…
8
votes
1 answer

wp_query and meta_query for repeater field values

I have a word press site with custom fields. I need to query a repeater field as a table. It looks like that: | param_1 | param_2 | param_2 | param_4 | 20 | 20 | 20 | 20 | 555 | 680 | 56 | …
matisa
  • 497
  • 3
  • 25
8
votes
1 answer

Custom post types & Pages hierarchy - Error 404

I've defined two custom post types: Theme Fiche I've also 7 pages using a defined rubrique template: (template-rubrique.php) Both my Theme and Fiche have an ACF post-object field. The Theme ACF post-object field is used to target a…
8
votes
1 answer

Complex custom_field search with meta_query

Background I am using Advanced Custom Fields Pro to manage my custom fields and they have a "repeater" field which contains sub fields that are stored as repeatername_X_fieldname where X is the row number of the repeater. I have a custom post type…
trex005
  • 5,015
  • 4
  • 28
  • 41
8
votes
2 answers

Advanced Custom Fields display last three sub-repeater rows

I am using Advanced Custom Fields (ACF) to pull repeater information from an events page and displaying a shortened list of the events on the home page. I have set up a repeater to allow the user to input which month the event will take place…
8
votes
3 answers

ACF Query Posts by Repeater Field Not Empty

This question seems to be unanswered on the internet, perhaps because it is not possible. I simply want to query all posts where the repeater field 'has rows'. i.e. $args = array( 'meta_query' => array( 'relation' => 'AND', array( …
Nick
  • 876
  • 1
  • 14
  • 35
8
votes
4 answers

PHP if/else get_field() with WordPress

I'm trying to give a client some options in the WP backend to customize a carousel that is displayed on their website's homepage. I am using Advanced Custom Fields to handle getting the input from the client. I want to give them two options: Option…
marcusnjones
  • 1,085
  • 1
  • 10
  • 18
8
votes
3 answers

Change Google Maps marker icon when clicking on other

I have created a Google Maps Multiple locations page, using Advanced Custom Fields Google Map field. I have managed to make the marker icon change when clicked on, but I want it to be changed back when clicking on other icons. here is an example of…
8
votes
3 answers

ACF relationship fields - get_field values from other post type

In my POSTS page (regular post type), I have setup a ACF relationship field. Inside this I can select company name which are all under the post type of directory_listings. Now, I have the following code on the directory listings page, and therefore…
wharfdale
  • 1,148
  • 6
  • 23
  • 53
8
votes
5 answers

Wordpress ACF get_field( ) not returning value

I am using the advanced custom field plugin for Wordpress. I am having difficulty displaying a field on my page. Basically I've created a field group and assigned id's to the members of that group. I then use the get_field('field_name') function to…
Javacadabra
  • 5,578
  • 15
  • 84
  • 152
8
votes
4 answers

Get custom fields values in filter on wp_insert_post_data

Hi all, thanks for reading. Environment : Wordpress + Advanced Custom Fields plugin Problem : I have searched for hours now and I can't seem to find the correct syntax to do the following: When posting a new post, get custom field value in order…
maleykith
  • 117
  • 1
  • 6
8
votes
2 answers

Including ACF in functions.php (WordPress)

I'm making a theme to sell on theme forrest for the first time. I've used ACF as a standard plugin during development to make sure everything's working. I've almost finished so decided to export my ACF to PHP and include it into my functions.php…
lukeseager
  • 2,365
  • 11
  • 37
  • 57
7
votes
3 answers

How to programmatically add an ACF group to the backend of Wordpress?

I've tried a bunch of different functions and approaches but so far I haven't been able to get it working. The goal is to add an Advanced Custom Field group to the backend of Wordpress with some PHP-code. In the best scenario we add the PHP-code to…
Floris
  • 2,727
  • 2
  • 27
  • 47
7
votes
1 answer

Can I use Javascript to update a default class in the Wordpress Editor?

In the WordPress Gutenberg Editor, I am trying to programmatically set a default class on an image block, which is applied without the user manually adding it via the 'Additional CSS' field. I have tried applying a default style on image blocks,…
7
votes
1 answer

Wordpress: Archive page with Filter doesn't work (ACF)

Im trying to filter my custom post types by a checkbox field of ACF. I work with this tutorial: https://www.advancedcustomfields.com/resources/creating-wp-archive-custom-field-filter/ Now I got the problem that nothing change, when ich filter over…