Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [advanced-custom-fields]

**NOTE** Support for this plugin is off-topic. Support questions should be asked on the plugin's support page.

0
votes
1answer
10 views

Delete ACF repeater field row on Front End

I would like to delete row from front end. This is what i did : HTML : <?php $row = get_row_index(); ?> <tr data-rownum="'. $row .'"> <td> <span class="deletecontrat ...
0
votes
0answers
14 views

Creating Gutenberg Block with ACF programmatically

I am trying to make Gutenberg blocks using the beta version of ACF which provides support for it. I am able to do so with the GUI (as shown first) but cannot do so programmatically. In the functions....
0
votes
0answers
26 views

Populate ACF field with cpt permalink

I'm using acf custom database addon to store my CPTs and acf data in a database other than wp_posts and wp_post_meta. One part of the post_meta which does not copy over is the ...
0
votes
1answer
18 views

Same ACF Relationship field for multiple Post Options sub-pages?

How can I ensure that the data saved by an Advanced Custom Fields Relationship field, when on an Options page for a Post type, is separate? Detail below: I have an ACF field group, “Features”, ...
0
votes
0answers
61 views

Programmatically Update ACF Options Page

Consider the following ACF Options Page: if( function_exists('acf_add_options_page') ) { $option_page = acf_add_options_page(array( 'page_title' => 'Theme General Settings', ...
1
vote
1answer
24 views

Using Gutenberg parse_blocks Function With ACF Custom Blocks?

I am trying to separate Custom ACF Gutenberg Blocks from the rest of the core blocks on a post. Currently I am using the_content(); This is grabbing every block in the Gutenberg Editor. What I want to ...
0
votes
0answers
20 views

Add select filter based on acf field to custom post type in dashboard

Good morning everyone; I am trying to add a select filter like this: Select filter based on taxonomy To do this, I am getting all field values like: Display all select field values I am able to ...
1
vote
2answers
31 views

Assign category from custom field on post creation and update

I'm trying to hook on save_post to automatically assign a category (from a custom field) on post update and creation. Basically if the date event is 10/10/2020 - I want to assign the event to category ...
0
votes
0answers
13 views

Is it possible to capture User-based ACF fields during MemberPress signup?

I know that MemberPress gives you the ability to define custom fields. However, we have a series of ACF [Advanced Custom Fields] that we have defined for our users, and would like to capture some of ...
0
votes
1answer
30 views

Filter Pages by Custom Field (ACF) in admin area

I'm trying to filter pages in admin area by a custom field created with ACF. I found a function here ( http://www.iamabdus.com/blog/wordpress/filter-custom-posts-by-custom-field/ ) and I adapted that ...
1
vote
1answer
19 views

How can I pass a variable set by ACF to header.php?

I have created a custom field with Advanced Custom Fields for my posts. My variable is set product_image, so I can print it with: <?php the_field('product_image'); ?> But I need to print it in ...
0
votes
1answer
23 views

Free version of Relevanssi doesn't show ACF fields

I understand the Premium version of Relevanssi has support for ACF fields built in but I have the free version. I'm working on a way to grab the information from the database and then spit it out on ...
2
votes
1answer
117 views

Using Advanced Custom Field (ACF) to insert meta description on each page

I have used ACF hundreds of times but never to edit the meta description. I have created a simple text field in ACF, then tried to use this script: <?php $meta_description = get_field('...
0
votes
1answer
23 views

How can I count ACF sub_field with a certain value

I have a sub field that have several different values. What I'm trying to do is count the number of rows if they're equal to Mayor. So my code looks like this: if( have_rows('candidates') ): ...
0
votes
1answer
32 views

WP_Query, ACF field and array

First of all, sorry this title, I really don't know how title the question without write a blobtext! :) Anyway, my problem is this one: I have a custom post "Risorse" (en: Resources). It supports ...
0
votes
2answers
20 views

Display ACF if parent page has specific template

I am trying to make a new ACF rule to display fields when parent page has a specific template name. Here's my current attempt: add_filter('acf/location/rule_types', 'acf_location_rules_types'); ...
1
vote
1answer
23 views

Query pages for use of a flexible content layout

I have a site that originally used a repeater field for selecting layout options. I now use the flexible content field. I need to be able to query the site for pages that use “featured-resources” as a ...
0
votes
1answer
13 views

ACF URL behavior, duplicating links

I am trying to use the ACF URL field to wrap a card component inside a url, then use the same url inside of this component in a button, this is because of styled reasons in the CSS. This is my code: ...
-1
votes
1answer
38 views

How to use acf field value to order category?

I am trying to order category by acf field value. How can I achieve this using acf filed value? $categories = get_categories('taxonomy=toc_category'); $sorted_cats = array(); foreach($...
0
votes
0answers
15 views

How to add new term-meta field in get_the_term array?

I am creating an API which is based on for category posts. In taxonomy category there is one ACF field for image upload. In API i am fetching category values like this: $cat_post = new stdClass(); ...
0
votes
0answers
23 views

How to display custom post type pagination buttons when processing AJAX request

Good morning everyone, I am trying to filter posts using ajax by custom fields and custom taxonomy values from a custom post type. Ajax request works fine, It retrieves all needed data to display, but ...
0
votes
1answer
22 views

Wordpress API response filter by ACF value

I'm building a site with wordpress API. I'm using Advanced Custom Fields, and also ACF to Rest API plugin to expose ACF data in API: https://github.com/airesvsg/acf-to-rest-api Now I'm trying to ...
1
vote
0answers
31 views

Wrap Gutenberg blocks both frontend/backend (PHP approach with ACF)

I'm currently running ACF 5.8 Beta 4 & WP 5.1 and I'd like to know if it's possible to wrap Gutenberg blocks in a parent div. For example, the following code allows to do precisely that and apply ...
1
vote
0answers
14 views

Meta Query Not Returning Output Despite Having Matching Values

I am formulating a query to pull from a custom post type, with values matching a custom field. The results are blank although I have 3 values set matching the custom field. Is my query formulated ...
0
votes
1answer
41 views

Getting property of non-object when looping through post objects from ACF

I am building a site using Root's Sage Wordpress theme which uses the blade templating engine. I have a repeater field in ACF with many post objects. When I foreach loop through the repeater to ...
0
votes
0answers
13 views

Display List Of Posts THAT NOT Contain a Relationship Field Value [ACF]

I saw articles like that before and I tried different things but nothing run. I want to show posts THAT ARE NOT in relationship. I want to make two lists without duplicate. To show the relationship ...
0
votes
2answers
18 views

Help using an array in 'exclude' key of another array

I want to exclude two items (using their IDs) from an array that's retrieving images attached to the post: the post's thumbnail (featured image) and an image attached via Advanced Custom Fields. I'm ...
0
votes
0answers
30 views

ACF - Relation field return nothing

i’ve readed doc about relation field for ACF, and it seems to be exactly what i need. Perhaps, i’m not able to get it work on front end. Maybe i’m doing something wrong ? my process : i have a ...
0
votes
0answers
38 views

ACF & Contact form 7

I'm currently struggling with ACF and Contact Form 7. I have a field in ACF: <?php the_field('les_besoins_du_projet'); ?> I would like to use it in a <select> for ...
0
votes
1answer
149 views

ACF Date Form in Custom Admin Field

I have this function code, that brings in a ACF date picker data, and adds it to the columns view. It;s raw format is YYYYMMDD My next step is to change the format of the date to, Day Month Year so ...
0
votes
0answers
34 views

ACF Pro Date Picker not coming through on Loop

I have a CPT with a set of fields set by ACF Pro - one of which is a date picker. I created a shortcode that can display these CPT's to a page and everything works except for the date. The date that ...
0
votes
0answers
42 views

ACF Loop Relationship Field Posts by Custom Taxonomy Term

I'm using the 'Post 2 Post for ACF' plugin (https://wordpress.org/plugins/post-2-post-for-acf/) to link 2 ACF relationship fields, for 2 different Custom Post Types. Everything is working great but I'...
1
vote
1answer
52 views

Remove the first 5 characters of the_title and orderby that

I have a custom post type where all titles are dates (in this format: YYYY-MM-DD). I need to order them by month then day, but not at all by year. So I imagine I need a filter to 'look' 5 characters ...
0
votes
1answer
34 views

Wordpress and Advanced Custom Fields and Flickity

I am trying to add [Flickity Carousel][1] into my Wordpress theme. I was successful yesterday. However, when I returned to my theme this morning the carousel files are not loading. I am not sure what ...
0
votes
1answer
25 views

Assign IDs to headings in ACF using functions.php

I'm assigning IDs to each heading on my Wordpress site. It works fine for pages where I don't use ACF with the following code snippet in functions.php function auto_id_headings( $content ) { $...
0
votes
0answers
45 views

Adding specific custom fields (images) to post excerpt

I am working on a simple user profile archive, using the theme "Atomic Blocks" as a starter theme. I am using one custom post type and several custom post fields to create these user profiles. The ...
0
votes
1answer
19 views

I want to place a post before all others from an ACF boleen field

I am currently trying to retrieve an post (to put it before all others in the search results of a search filter I created) from an ACF boolean field (and I am a beginner), so I made this script but I ...
0
votes
1answer
95 views

How To Import CPT With Only Few TEXT ACF Fields From Front End?

I have registered CPT "Contacts" and I have created 3 text fields: name, phone and address. All those fields are set as text fields, and now I want to allow admins to import CPT with those fields from ...
0
votes
0answers
18 views

wp-query: order by a custom-field and get one random item of another custom-field

I have a "brand" page (ex. Nike). When I click on "Nike" page I would like to show a list of all categories of their products (ex. shoes, thirts ecc). Each category of their products is listed by a ...
0
votes
1answer
21 views

Batch Extract Date from post title and put into ACF custom field

I have a custom post type called 'events' with around 700 posts, the titles are consistently formatted like this: Event Title - January 1st 2019 I need to isolate the date in another field. I am ...
0
votes
0answers
33 views

filter using custom fields

I am working on a job search page. I have created job category, job location, job description and posted date using Advanced Custom Fields. I want to display the job location and category in a select ...
0
votes
1answer
6 views

How to hide sub fields in a field group and also the entire field group if the answer selected is “no”

I have a field group (repeater field type) set up (titled "Units") with sub fields; sq footage, floor plans and availability (this is a yes/no selection). I have the availability sub field to display ...
0
votes
1answer
13 views

Create 3 Levels of relations with Wordpress

I need to create this type of relation in Wordpress: A Catalog can have many Products A Product can have many Catalogs A Category can have many Products A Product can have only one Category So when ...
0
votes
0answers
16 views

Getting the updated value when try to get the value in ACF

I am using the following code in the validate_save_post hook. foreach ( $diff_quantitites as $id => $diff_quantitiy ) { // acf_delete_cache(); $...
1
vote
1answer
32 views

ACF: How to make get_field() ignore the main wp query?

I have a filter applied to the main WP query via a load action (pre_get_posts) for all the admin pages in my website. It simply limits the edit (listing page) to show records created only by the ...
0
votes
0answers
49 views

ACF (Advanced Custom Fields) not updating post or postmeta values

After changing the name of a ACF field, existing fields for some posts are not updating, but some are. Also, new posts are recorded correctly and can be updated. It's just that some of the old ones ...
0
votes
0answers
22 views

Display ACF field(s) from widget in FE

I have a problem with displaying ACF fields that I've connected with a custom created widget. Here what I have so far. I've registered a sidebar function myfunction_init() { register_sidebar( array( ...
-1
votes
2answers
35 views

Display ACF field only if value is greater than 0

I have an ACF field of paid_attendance - I only want it to display the field if the value is greater than 0. The below code only works if I swap >0 out for an actual number (and that number matches ...
0
votes
0answers
9 views

Using AJAX select field to search and store external relationship in Advanced Custom Fields

I'm trying to get a select field with the "Stylised UI" option to fetch values dynamically using AJAX. The goal is to store a reference to an external ID as well as being able to search in the ...
0
votes
0answers
29 views

Convert number to date format within an array

I have a custom field of deal_date that I need to work into an array. When using directly on a template I can just set the output format directly in the ACF UI. However I obviously cant use get_field ...