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
3
votes
2 answers

Repeater Field empty in ACF

I'm fairly new in using ACF so I used the code that was displayed in their site to display what is inside of my repeater field. However, when I try to show the repeater's content it is empty?? This is my code, this is still in trial mode just to see…
Amiel M
  • 57
  • 1
  • 8
3
votes
2 answers

Error in filtering custom post by acf fields in admin

I am adding filter for custom post 'magazine' by acf fields 'issue_year'. I create the dropdown and filter the post but I am getting following error. Error: WordPress database error Not unique table/alias: 'wp_postmeta' for query SELECT…
samjhana joshi
  • 1,995
  • 4
  • 35
  • 69
3
votes
3 answers

wordpress advanced custom fields and polylang integration

I used ACF plugin to build my page, I wanted to create the page that client could change what he wants in it. But I need to translate this page into 5 languages. I installed polylang, can't buy a pro version. I want to that my custom fields could be…
3
votes
2 answers

Wordpress plugin Advanced Custom Fields Pro not saving Frontend and Backend

I am using A custom Post Type with Advanced Custom Fields to create custom entries of a post. My Customs Post Type and Options are added with (please scroll on codebox to see all): add_action( 'init', 'register_cpt_campaigns' ); function…
Darren
  • 2,176
  • 9
  • 42
  • 98
3
votes
0 answers

Advanced Custom Fields: update_sub_field before saving post

Expected behavior: When user updates an ACF in the WP dashboard and hits UPDATE, code will check for updated Status field and if values have changed, will also modify Last Updated field, then save all information. Reality: The overall content is…
3
votes
4 answers

Pulling PHP data into JS to dynamically change BG image on screen width

In my WP Template I created two Sub fields in my Repeater custom fields for bg imgs: The large device and desktop bg The mobile bg In my content-section.php template part, I created a loop and inject get_sub_field('background_image'); as a bg…
3
votes
0 answers

ACF page link shows wrong archive url

I have a custom post type 'products' and use polylang to localize content and rewrite urls. Since I changed the rewrite from 'products' to 'tools', acf shows me the wrong url for the tools archive in a page-link field. Where before it showed…
Patrik K
  • 31
  • 1
3
votes
3 answers

Multiple PHP if statements

My code below is checking to see if a Wordpress member is male or female, and the displaying certain code based on this. I am trying to optimise the code below to avoid having to have 2 copies of the entire code block, as it appears to me that I…
dungey_140
  • 2,602
  • 7
  • 34
  • 68
3
votes
2 answers

Get ACF field key programmatically by field name

I need to get the field key by field name in WordPress in the Advanced custom fields plugin (ACF). The field is assigned to a post. I am in the loop of the post and I want to get the field key programmatically USING field name. The reason for this…
Christophfen
  • 31
  • 1
  • 3
3
votes
2 answers

ACF get_field() returns empty

I'm developing an application through custom post type with custom fields using ACF plugin. When the custom post type is saved, it will create a blog in my network which works great however, when trying to copy the custom fields from the custom post…
Ken
  • 833
  • 2
  • 13
  • 27
3
votes
2 answers

Check if date is in past

I've a custom page for Wordpress where I check if a ACF (advanced custom field) date value (sorted m-d-Y) is < = > of date(m-d-Y). If ACF value have 2016 year all work, if year is 2017 function doesn't work. example of code: if…
lupet
  • 55
  • 6
3
votes
0 answers

Wordpress not sorting by custom field when tax_query is active on custom taxonomy

I have to sort the products by price. I'm srugling with this task, because my query works only when any custom taxonomy querying is off. This is query that works, yet it doesn't filter posts by a specific product_category: $args = array( …
Swagger
  • 107
  • 8
3
votes
1 answer

I want WooCommerce to treat existing custom post types as products immediately WITHOUT re-saving each post

I have millions of posts (using a custom post type called "case"). They each have a lot of post_meta records (using ACF). I now want woocommerce to treat these "case" CPTs as products (without changing their actual post type to "product"). I'm using…
3
votes
2 answers

How to update repeater field if I have the array key to it?

I've found this code which is supposed to update a repeater field in ACF Wordpress. My repeater has 3 columns. I need to update only a certain field from one column in the repeater. How to do that with this code: // save a repeater field…
Ionut Necula
  • 11,107
  • 4
  • 45
  • 69
3
votes
0 answers

Register Memberships with Advanced Custom Fields

I'm currently trying to figure out a process of creating a paid membership account using Advanced Custom Fields. What I'm trying to do is create a directory with Advanced Custom Fields & Custom Post Types, which is easy enough to do but what I need…
user3181828
  • 371
  • 2
  • 5
  • 18