Home Forums Search Search Results for 'event date repeater'

Search Results for 'event date repeater'


  • Solved

    How to sort posts by dates after $today?


    Say I have a cpt “events”, and these events will happen on multiple dates. I then add a repeater (event_dates_repeater) so that I can add all the dates (event_date) in which the event will take place. I want to query these posts on a page so that the next event that’ll happen will always be the first shown. However, having multiple dates inside a repeater, it would have to work in such a way that when the first date of an event is already done, the query would now orderby the second closest date after $today.

    I do understand how to order a query by a specific meta_key, but I’m not sure how to filter this meta just to use the next closest date subfield after today.

    Thank you!

  • Solving

    Repeater inside a group

    Hey all!

    I have the following ACF structure.
    A group with a repeater inside. The repeater also has two subfields, a text and time field

    > repeater
    >> Text – subfield
    >> Time – subfield

    I’m trying to add multiple rows of the repeater with an event schedule.

    $group_key = 'field_64e765bfc42ef';
        foreach ($event->lineup as $item) {
            $value = [];
            $value = array(
                'field_64e76f9210338' => array(
                        'field_64e770e717754' => $item->details,
                        'field_64e770f317755' => $item->time
            update_field($group_key, $value, $post_id);

    The data in the API is structures as follows:

    "lineup": [
    "details": "Doors open",
    "time": "9:00 PM"
    "details": "Last Entry",
    "time": "11:00 PM"
    "details": "Curfew",
    "time": "11:00 PM"

    For each repeater row. I’m trying to output every “details” and “time” inside the “lineup” array. The output would be something like the image attached image.

    Is it possible to set up a repeater this way inside a group? I’ve tried a few different things but I only get one of the items in the line up array to output in the repeater. I’m not sure if this is possible, or if it’s something to do with the syntax etc. Hope this is making sense. Any help would be greatly appreciated.


  • Helping

    Automatically create and prepopulate some repeater fields

    I’m using ACF to create a tuition planner. The fields will include a Total tuition fee field, a Deposit field, and a Number of installments field (a drop-down with values from 2 to 12). And finally a repeater field with fields: Installment amount, Due Date, Paid (a checkbox), and Date of payment.

    Ideally, what I’d like is a way to create and pre-populate the Installment amount fields of the repeater as soon as the admin selects the number of installments from the drop-down (if, of course, the Total tuition fee field and Deposit field are already filled in.

    Of course, you understand the logic, that the JS invlolved will subtract the deposit from the total, then divide it by the number of installments, and that amount will pre-populate the Installment amount of the repeater rows (the rows will be, of course, the same number as the Number of Installments selected in the drop-down.

    I’m not interested in the JS part that will “listen” to the change event of the Number of installments drop-down… Nor the arithmetic calculations of the amount of the installment – that’s the easy part…

    I’m interested in a way to dynamically create the repeater rows. I assume it will have to be something that will trigger the methods involved when the Add row button is pressed, but I’ve never done it before, so I thought to ask here before I dig into the code to find out the hard way how it’s done by ACF.

    Any help will be very much appreciated. TIA.

  • Solving

    update_field returning large int instead of bool

    I’m using ACF Pro to create a Learning Management System. I’ve only recently started having problems. The main one that’s giving me the most trouble is that update_field() is not actually updating the field, despite me giving it accurate information and it working on a local environment (but not a WP Engine Dev environment).

    Currently I’m allowing the user to create a new Course (or “Module”), based on a previous one, specifically for their class. They choose which students they’ll be including, the Module to use a template, then the Chapters (or “Documents”) from that Module.

    Then, on the final screen, they review information, and the “Submit” button starts through a series of AJAX calls that sends the information to the server, sends back the pertinent info, then moves on to the next step.

    I’m sending back the results from each delete_field() and update_field command. When replacing values, I am deleting the current value (with delete_field()) before using update_field(). This has helped some of my issues, but not all.

    Here is the pertinent PHP code:

    // I've made the CPT "Module" its own Class to contain its helper methods 
    $module = new ACF_Module( intval($module_id) );
    // I store the Documents (or "Chapters") for each Module (or "Course") as a 
    //     repeater field containing the document_id and the order it should 
    //     appear within the Module.
    $document_ids = json_decode( $_POST['document_ids']);
    $documents_field = [];
    $count = 1;
    foreach( $document_ids as $document_id ) {
        $documents_field[] = [
            'document_id' => intval($document_id),
            'order' => floatval($count),
    // In JS, $documents_field_deleted = (bool) true
    $documents_field_deleted = delete_field($module->documents_field, $module->ID);
    // In JS, $documents_field_updated = (int) 625785,, or a similarly large number,
    //     which does not correlate to ANY existing post ID or user ID, as the 
    //     newest post_id in this example is 43113 and largest user ID is 1126
    $documents_field_updated = update_field($module->documents_field, $documents_field, $module->ID);

    I don’t know that this will matter, but just in case, here’s my JS doing the AJAX calls:

    // Triggered when clicking submit button labelled "Next"
        // I'm just storing values in hidden <code><input></code> fields. Since these 
        //     classes are all taken on a job-site, where the student is 
        //     monitored, I'm not concerned as much for the user being able to 
        //     change these.
        var nextAction = '';
        actionStep = $('input[name="acf_action_step"]').val();
        var payload = {
            action: 'acf_action_function_name',
            action_step: actionStep,
            agency_id: parseInt($('input[name="acf_agency_id"').val()),
            module_id: parseInt($('input[name="acf_module"]').val())
        switch (actionStep) {
            case 'module':
                payload.module_title = $('input[name="acf_module_title"]').val();
                nextAction = 'chapters';
            case 'chapters':
                payload.chapter_ids = $('input[name="acf_chapters"]').val();
                nextAction = 'user';
            case 'user':
                var user_object = JSON.parse( $('input[name="acf_users"').val() );
                nextAction = 'user';
                if( user_object.length == 1 ) {
                    nextAction = 'finish';
                payload.user_id = parseInt( user_object.shift() );
                user_ids = JSON.stringify(user_object);
            case 'finish':
                $('#submit').prop('disabled', true);
            url: ajax_object.ajax_url,
            type: 'post',
            data: payload,
            beforeSend: function(){            
                $('#submit').prop('disabled', true);
            success: function(response) {
                var response_object = JSON.parse(response);
                if( response_object.new_module_id ) {
                    $('input[name="acf_module"]').val( parseInt(response_object.new_module_id) );
            complete: function(response) {
                $('input[name="acf_action_step"]').val( nextAction );
                $('#submit').prop('disabled', false);
  • Solved

    Select not displaying labels correctly

    Hello! I’m making a planner with advanced custom fields, and once logged in, the admin users can add rows of a repeater group in a page from the frontend. I made this code but the select isn’t displaying the labels, only the values. Can somebody find the issue? I tried so many things already…

                    // get the repeater field key and the post ID
                    $repeater_key = 'tareas'; // replace with your field key
                    $post_id = 19744; // replace with your specific post ID
                    // get the existing rows of the repeater field for the specific post ID
                    $existing_rows = get_field( $repeater_key, $post_id );
                    // get the options for the select field from another field within the same repeater group
                    $select_options = array();
                    foreach( $existing_rows as $row ) {
                        $select_option = $row['categoria'];
                        $option_value = $select_option['value'];
                        $option_label = $select_option['choices'][ $value ];
                        if( !empty( $select_option ) ) {
                            $select_options[$select_option] = $select_option;
                    // check if form has been submitted
                    if( isset( $_POST['submit'] ) ) {
                        // check if all fields have been filled in
                        if( !empty( $_POST['titulo'] ) && !empty( $_POST['fecha'] ) && !empty( $_POST['categoria'] ) ) {
                            // create a new row with the submitted data
                            $new_row = array(
                                'titulo' => $_POST['titulo'],
                                'fecha' => $_POST['fecha'],
                                // add additional sub fields as needed
                            // add the select field to the new row
                            $new_row['categoria'] = $_POST['categoria'];
                            // add the new row to the existing rows
                            $existing_rows[] = $new_row;
                            // update the repeater field with the new rows for the specific post ID
                            update_field( $repeater_key, $existing_rows, $post_id );
                            // redirect to the same page to prevent form resubmission
                            wp_redirect( home_url('/planner') );
                        } else {
                            // display error message if not all fields have been filled in
                            $error_message = "Para añadir esta tarea, todos los campos se tienen que rellenar completamente.";
                    <!-- display the form to add a new row -->
                    <form method="POST">
                        <input type="text" name="titulo" placeholder="Título">
                        <input type="date" name="fecha" placeholder="dd-mm-yyyy">
                        <select name="categoria">
                            <?php foreach( $select_options as $option_value => $option_label ) : ?>
                                <option value="<?php echo $option_value; ?>"><?php echo $option_label; ?></option>
                            <?php endforeach; ?>
                        <!-- add additional sub fields as needed -->
                        <input type="submit" name="submit" value="Añadir tarea">

    Thank you!

  • Solving

    Repeatable events ordered by date from repeater field

    Hi, I have cpt ‘events’ and trying to do repeatable events.
    Simplyfy – an event has ‘title’ and ‘start_date’. Dates are in repeater field (‘start_date_repeater’) becouse one event can repeat.
    Here is my code:

    $today = current_time(‘Y-m-d’);
    $posts = get_posts(array(
    ‘posts_per_page’ => -1,
    ‘post_type’ => ‘events’,
    ‘meta_query’ => array(
    ‘key’ => ‘start_date_repeater’,
    ‘compare’ => ‘>=’,
    ‘value’ => $today,
    ‘meta_key’ => ‘start_date_repeater’,
    ‘orderby’ => ‘meta_value’,
    ‘order’ => ‘ASC’

    <?php if( have_rows(‘start_date_repeater’) ):
    while( have_rows(‘start_date_repeater’) ) : the_row();
    <h3><?php echo the_field(‘title’); ?></h3>
    <div><?php echo the_sub_field(‘start_date’); ?></div>
    <?php endwhile; endif; ?>

    I need output like that:
    event01, 15.03.2023
    event02, 16.03.2023
    event01, 17.03.2023
    event01, 18.03.2023
    event02, 19.03.2023

    But I got that:
    event01, 15.03.2023
    event01, 17.03.2023
    event01, 18.03.2023
    event02, 16.03.2023
    event02, 19.03.2023

    How can I order events by date not by title?

  • Solved

    Putting ACF fields inside other ACF fields

    Hi everyone, I was wondering how I would go about putting fields inside other fields… I’m guessing it’s just a matter of CSS?

    We have a field group that uses repeater; it is used for Events. I need to have an image a certain size, and then have a date overlayed on the image, and then the title of the event and time.

    Please see example here –

    Any advice would be greatly appreciated, as I’m not sure how to go about doing this 🙁

  • Helping

    Saving data in a repeater or in a specific custom post type?

    I have a “provider” custom post. I would like to save the invoices received from each provider (not the actual invoice file, just a few data : invoice number, date, amount.)
    I have 2 choices :
    – Either I create a repeater in the provider custom post type.
    – Either I create an “invoice” custom post type with these few custom fields + a relationship field to assign each of them to the corresponding provider.

    I tend to prefer the first option because it seems lighter (i don’t really want to create a custom post type specifically to save a few fields) but I also read somewhere that ACF repeaters are not made to have hundreds of rows (which some providers will have eventually after a few years).
    Which solution makes more sense from a database/performance point of view?

    Thank you !

  • Solved

    modifying the post object return value on backend

    Not even sure this is possible, but hoping someone can help…

    We’re building a site that is using the events calendar plugin to create events.

    I’ve created a repeater for pages that has a post object field set to events to allow us to select (and promote) an event on the page, which works fine.

    The problem is we have 3 venues, and for simplicity for the client, events are named by the date, so for example, 13 August 2023, but doesn’t refer to the venue.

    This means that if we have two dates, but different locations, it’s impossible to determine in the post object selector in the repeater what venue event you’re choosing.

    The event has a venue field you select, so it’s stored in the meta data.

    What I’d love to be able to do is modify the output in the post object dropdown to include the venue name – for example 13 August 2023 (venue A).

    Does anyone know if I’m chasing rainbows or if this is actually possible? I can’t find any links to help me figure it out.

    Thanks in advance

  • Helping

    Order CPT Archive by nested Date Field within a Repeater

    I have Custom Post Type (CPT) of Event, which has a Repeater Field named dates, with a Date Field sub_field named date. I am looking to order the Archive results for Events by the most upcoming date in the Repeater field.

    Currently I have the following.

    $date = date('Ymd');
    $args['suppress_filters'] = false;
    $args['meta_query'] = array(
        'key' => 'dates_$_date',
        'compare' => '>=',
        'value' => $date,
        'type' => 'DATE',
    $args['meta_key'] = 'dates_$_date';
    $args['order'] = 'ASC';
    $args['orderby'] = 'meta_value';

    The meta_query seems to be working because all past dates are being filtered, but the order functionality isn’t working as I’d hoped.

    Is this the right way to approach this issue? Any issues standing out?


  • Unread

    How to parse_blocks with a repeater/subfields?

    I’m working on a custom block and I wold like to parse data from that block on the homepage. The issue I have is that I cannot show data from subfields inside a repeater. I’m using the parse_blocks like this:

    function get_daily_training_date()
    	$sections = array();
    	global $post;
    	$blocks = parse_blocks($post->post_content);
    	foreach ($blocks as $block) {
    		if ('acf/trainingevent' !== $block['blockName'])
    		$daily_dates = '';
    		if (!empty($block['attrs']['data']['daily_trainings']))
    			$daily_dates = $block['attrs']['data']['daily_trainings'];
    		$sections[] =  esc_html($daily_dates);
    	if (empty($sections))
    	foreach ($sections as $section)
    		$dates = date("F", strtotime($section));
    	echo $dates;
  • Helping

    Display Posts from sub-post Repeater Field

    I am having a hard time with something and hoping I can get a little assistance. Here is my goal:
    I have a web site where we put on multiple Events in various locations which inlcude Artist Instructors (primarily musicians) which change every year. We want to be able to provide a page where someone can go and see who taught at each location/year combo. Or to filter the list. I believe I need to do the following to make this work:

    • Have a Primary “Festival” page which has some information which can be over-written each year. Include metadata via ACF for the Location (A Clone field from the Overview post below so I do not have to edit Locations in multiple places) and the current Year (date picker formatted as YYYY only) we are registering people for.
    • Have a Post for each Artist wich is a Biography and includes an ACF field for their “Instrument”
    • Have an Overview Post which includes detailed information for teh current Year and a Repeater field for selecting Post Objects for the Biographies. I am using the Repeater field so we can set the Order in which the Biographies appear. This Overview post has ACF fields for
    • Location
    • Start Date (date picker)
    • End Date (date picker)
    • Artists (Repeater with a Post Object Subfield called Artist)
    • So Iam trying to create a Template for the Main Page. I can pull the appropriate Overview Post, but I am not getting the Artist Posts (Biographies) to display. I get the Title as a link for the First of Three in the list. After that I get 23 listings with no Title/Link and only the text for teh custom field with no entry (actually a foreach error but that is likely because some other data is being returned). Any idea where I may be off on this?


       * The template for displaying the primary festival location pages
       * Template Name: Festival Main
       * @package WordPress
       * @subpackage Boxwood\\
       * @since Twenty Twelve 1.0
      	<div id="container">
      		<div id="content">
      			<div id="main-column-full-width">
      				<?php /* The entry content */ ?>
      				<div class="entry-content">
      					<?php if(!is_front_page()) {?>
      						<?php if ( function_exists('yoast_breadcrumb') ) {
      							yoast_breadcrumb('<p id="breadcrumbs">','</p>');
      						} ?>
      						<h1 class="entry-title"><?php the_title(); ?></h1>
      					<?php }?>
                          if (have_posts()) :
                              while (have_posts()) :
      <h1>Start Latest</h1>
       * Get the Overview Post to pull data for retrieving other posts, etc
      $my_location = get_field('location_location');
      $my_year = get_field('year');
      $startyear = $my_year . '0000';
      $endyear = $my_year + 1 . '0000';
      $args = array(
          'numberposts'	=> -1,
          'post_type' => 'post',
          'category_name' => 'festival-overview',
          'meta_query' => array(
                  'key'     => 'location',
                  'value'   => $my_location,
              'key' => 'start_date',
              'value' => $startyear,
              'compare' => '>'
              'key' => 'start_date',
              'value' => $endyear,
              'compare' => '<'
      $overview_posts = new WP_Query( $args );
      // Show the Overview Post content
      if ( $overview_posts->have_posts() ) :
          while ( $overview_posts->have_posts() ) :
              // Check rows exists.
              if( have_rows('artists') ):
                  // Loop through rows.
                  while( have_rows('artists') ) : the_row();
                      // Load sub field value.
                      $featured_posts = get_sub_field('artist');
                      if( $featured_posts ): ?>
                              <?php foreach( $featured_posts as $post ): 
                                  // Setup this post for WP functions (variable must be named $post).
                                  setup_postdata($post); ?>
                                      <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                                      <span>A custom field from this post:
                                              $my_instrumentsarray = get_field('intruments');
      	                            	    foreach ($my_instrumentsarray as $my_instrument) {
                      	                        echo $my_instrument ;
                      	                } ?>
                              <?php endforeach; ?>
                          // Reset the global post object so that the rest of the page works correctly.
      //                    wp_reset_postdata();
          while ( $overview_posts->have_posts() ) :
                  if ( has_post_thumbnail() ) :
                  <div class="entry-content">
                      <?php the_content(); ?>
      // Restore original post data.
      				</div><!-- .entry-content -->
      			</div><!-- #main-column-full-width -->
      	</div><!-- #container -->
      	<?php get_footer(); ?>
  • Unread

    Meta Query inside a repeater field – how to

    I have record label website with a post type called “Tourdates” and I have custom fields for ticket links, venue, location, etc, and also DATE. Now, if this site was for one band, each “Tourdate” post type entry would have all the custom fields outside of a repeater, as it’s not needed. But since there are many bands, each “Tourdate” entry IS a band. And in that entry, I have a “tourdates” repeater field. So if entry is for Guns N Roses, and they have 5 dates, you enter in 5 items in the repeater field, so when you view the Guns N Roses singular entry, you see those 5 dates. That works. I use a meta query to then ONLY show dates today or upcoming. Works!

    This works for this scenario:

        $today = current_time('Ymd');
         args = array(
          'post_type' => 'tourdates',
          'post_status' => 'publish',
          'posts_per_page' => '150',
          'meta_query' =>
            'key' => 'showdate',
            'compare' => '>=',
            'value' => $today,
          'meta_key' => 'showdate',
          'orderby' => 'meta_value',
          'order' => 'ASC',
        $query = new WP_Query($args);
        if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
        <li class="show_event">
          // MY DATE LISTING with custom fields, showing only upcoming dates
      <?php endwhile; ?>
      <?php endif; ?>
      <?php wp_reset_postdata(); ?>

    Now, since for my needs, I am using a repeater field for one entry (band) to show multiple dates, I need to put the meta query INSIDE the repeater field so only current or upcoming repeater items show. Here is what I have, but don’t know how to do the above WITHIN a repeater field of a single post type entry. Help?!

    <?php if(have_rows('tourdates')): ?>
        <?php while(have_rows('tourdates')) : the_row();
          $venue_name = get_sub_field('venuename');
          $venue_link = get_sub_field('venuelink');
          $showdate = get_sub_field('showdate');
          $today = current_time('Ymd');
          $metaQuery = [
              'key' => 'tourdates_$_showdate',
              'compare' => '>=',
              'value' => $today,
          <li class="show_event w-100 h-auto pb-4 mb-4 d-sm-flex <?php if( $soldout == true ) { echo 'soldout'; }; ?>" id="post-<?php the_ID(); ?>">
            // MY DATE LISTING with custom sub_fields
      <?php endwhile; ?>
    <?php endif; ?>
  • Solving

    Saving and restoring flexible content layouts in JavaScript

    I would like to get the user-data of a flexible content layout block as JSON to create the exact same layout block on another page or even another website (of course with the same theme and flexible content container).
    The goal is to create a library of content block templates.

    Generating JSON of the current user-data of a content block is not that hard and works fine. Albeit I first tried to get a recursive representation of the data (e.g. when repeaters are used in the content block) and failed as every nested container type (repeater, groups, flexible contents, clone fields) needs to be addressed separately.
    Because of this and the problem that creating the new field with populating nested containers is really hard.

    Currently I am facing following issues:
    1) The values for e.g. image fields and date-time-picker fields are not set correctly. They seem to be empty. But when the post is saved, and the page reloads all values are filled and correct.
    2) Repeater rows will be in wrong order. Strictly speaking the last item will be the first, the others are fine.
    3) If the visibility of a field depends on the value of another field (conditional_logic) the field is only filled when the field it depends on is set before. I guess this could be circumvented by setting all field values once again, but that would be a real hack.
    4) Tabs within the new content block are not working as expected: All fields are visible until the tabs are clicked once, the only the fields belonging to the currently selected tab are visible. This could be prevented be triggering a click event on every tab.

    Here is our demo code.
    The code adds a Save button between the “duplicate layout” button and the “delete layout” button. When clicked the user-data is aggregated and written to console and then the same layout is added to the flexible content and filled with the data of the original layout.
    Yes this is actually the duplicate layout function, but this is just for testing.

    jQuery(function() {
    	let $buttonSave = jQuery('<a class="acf-icon -save-as-template small light acf-js-tooltip" href="#" data-name="save-as-template" title="Save layout">S</a>');
    	jQuery('.acf-fc-layout-controls a.acf-icon[data-name="duplicate-layout"]').after($buttonSave);
    	jQuery(document).on('click', '.acf-fc-layout-controls a.acf-icon.-save-as-template', function(e) {
    		let $contentBlock = jQuery(this).closest('.layout');
    		let $flexible_content = $contentBlock.closest('.acf-field-flexible-content');
    		let flexible_content = acf.getField($flexible_content);
    		let data = {
    			layout: $'layout'),
    			fields: getContentBlockData($contentBlock),
    		let setAcfValue = function(field) {
    			let fieldKey = field.get('key');
    			for (let i = 0; i < data.fields.length; i++) {
    				let entry = data.fields[i];
    				if (entry.key && entry.key === fieldKey && entry.value != null) {
    					if (entry.type === 'repeater') {
    						for (let j = 0; j < entry.value; j++) {
    							if (field.getValue() >= entry.value) {
    					} else {
    					data.fields[i].key = null;
    		acf.addAction('new_field', setAcfValue);
    			layout: data.layout,
    			before: $contentBlock,
    		acf.removeAction('new_field', setAcfValue);
    	let getContentBlockData = function(parent) {
    		let data = [];
    		$fields = acf.findFields({
    			parent: parent,
    		if ($fields.size() <= 0) {
    			return data;
    		for (let i = 0; i < $fields.size(); i++) {
    			let $element = jQuery($fields[i]);
    			let field = acf.getField($element);
    			let type = field.get('type');
    			let key = field.get('key');
    			let name = field.get('name');
    			let value = null;
    			if (type === 'tab' || type === 'message') {
    			if (type === 'select_freetext') {
    				$element = jQuery($fields[i]);
    				field = acf.getField($element);
    			value = field.val();
    				type: type,
    				key: key,
    				name: name,
    				value: value,
    		return data;

    Is there a better, maybe totally different, way to achieve this?
    Has anybody ever done something similar?
    Help is very appreciated.

  • Unread

    Dynamically update block on another page


    I have 2 post types Team and Events, Team has a block called events where you can select events (repeater) and Events has a block where you can select Team members (repeater). I am trying to on save of Team or Events to update the block on the other CPT to have the the new ID of the post you are saving, I can’t find anything online that will help me accomplish this, My code is below and i can get the block on the other CPT fine but i am unsure on how to update that block any help would be greatly appreciated

    add_action( 'save_post_team', array( $self, 'save_person_to_event' ), 10, 3 );
    public function save_person_to_event( $post_id, $post, $update ) {
    		if ( has_blocks( $post->post_content ) ) {
    			$person_blocks = parse_blocks( $post->post_content );
    			foreach ( $person_blocks as $key => $block ) {
    				if ( 'acf/events-feed-slider' === $block['blockName'] ) {
    					$events_field = $block['attrs']['data']['events'];
    					if ( $events_field ) {
    						for ( $i = 0; $i < $events_field; $i++ ) { 
    							$event_id = $block['attrs']['data'][ 'events_' . $i . '_event' ];
    							if ( (int) $event_id ) {
    								$event_post = get_post( $event_id );
    								if ( $event_post && has_blocks( $event_post->post_content ) ) {
    									$event_blocks = parse_blocks( get_post( $event_id )->post_content );
    									// var_dump($event_blocks);
    									foreach ( $event_blocks as $event_block ) {
    										if ( 'acf/team-and-author-card-slider' === $event_block['blockName'] ) {
  • Helping

    Should I avoid using Repeater in this situation ?


    I’m building some kind of CRM tool for my event agency, based on wordpress and ACF.
    Each client/event is a custom post in which I have, among other things, a repeater with a few subfields to enter the different payments made to us by the client.

    I would also like to have a page (in the admin) on which I can have an overview of all the payments made by all the clients. With, if possible, the possibility to reorder and filter the payments (by amount or date for example) – and for each payment a link to the post so as i can edit it.

    From what I understood reading these forums, repeaters are overused and can cause different types of problems.

    1) Does the fact my values are in a repeater make this feature less safe (more prone to cause errors) ?

    2) Does it make the queries a lot more complex, impacting performance when filtering for example ?

    3) If yes to any of these 2 questions, is there a better way to handle this ?

    Since I don’t have many subfields in the repeater and I won’t have that many payments in each post I could possibly create the fields in simple groups (with each new line appearing when the previous one is filled), but I don’t know if that would make things any better.

  • Helping

    Multiple dates in date picker?

    Hi. There is a seemingly abandoned MultiDatePicker plugin for ACF, but I can’t find any other way to add more than one date to the date picker in the FREE version of ACF, ie not using a repeater. I know I can just add a second field, but was hoping there’s a free extension out there that I haven’t been able to find. It’s for events, most single events, but a very few by the same artist on separate days at different times. Am hoping there’s a solution I haven’t thought of, because I’m making a mess.

  • Solved

    using acf_form field type USER – display first name?

    Hi Guys,
    We have a form working on the website and it works without any issues. We’re using it to schedule different speakers at an event. Each of the speakers are users, so the group leader can pick from the entire userbase as to who is next in rotation.

    Inside of a “meeting” repeater (field_60248b8f9ab12), we have a field for “speaker” and it is assigned the Field Type “User”, with a return format of “User Object” (along with other fields etc)

    On the front end of the website, we show the table of who is coming up and everything works perfect.

    By default, in both the backend and the front web form, when we select the User, it shows the display name of the person.

    Is there a way to display the first & last name of the person in the dropdown rather than the display name? So instead of it showing “bbincs” it shows “Bobby Brown” – the actual name of the person?

    As I said, the form works just fine, and the display to normal users is fine as we use a table for display, it’s just our leadership team that sometimes can’t determine who the person is as the display name is so different from their first/lastname.

    field_60248b8f9ab12 is the Repeater Field.

    Standard form

       $event_update_fields = array('field_60248b8f9ab12');
                'id'       => 'chapter-event',
                'post_id'  => $chapterid, //data received from Chapter dropdown on Leader Page (next section)
                'fields' => $event_update_fields,
                'submit_value' => __('Save Changes')

    Is there something I can add so that the Speaker Name (User) displays the first/lastname in the dropdown rather than their displayname?



  • Unread

    Using ACF with woocommerce to update order total

    Hi there. I am attempting to get ACF values in a repeater … that includes some totals for “custom line items” type system I have set up when creating a Woocommerce order. My issue is I need to update the order total , which I have working once the order is created.. but I need it to run through these BEFORE the order is created because the quote for the order gets created and the order total is 0 because the ACF values are not saved as soon as the order is created. I hope that makes sense. The real question is I have a function that runs when clicking the recalculate button, I would like to save the ACF values on click. I have found forums talking about using : “ if ( !isset($_POST[‘acf’][‘field_5bd0266e9f955’]) ) :
    $value = get_field(‘event_startingdate’);
    update_field(‘event_endingdate’, $value);” to get the ACF values but A) I don’t understand where field_5bd0266e9f955 is coming from and B) I don’t know if this POST method will work for repeater rows and subfields.

  • Solved

    How would you handle this? A legion of regions.

    Hi folks, how would you handle this weird request?

    I want to create fields for a bunch of locations that have a few fields in common.

    Kind of like this:

    Region 1
      [] Name
      [] Event Date
      [] Featured?
      [] Link
    Region 2
      [] Name
      [] Event Date
      [] Featured?
      [] Link
    Region 3
      [] Name
      [] Event Date
      [] Featured?
      [] Link
    Region 60
      [] Name
      [] Event Date
      [] Featured?
      [] Link

    Now you might think that a repeater field is the way to go, and you might be right.

    However, but there are a few special requirements:

    1. Every region has a unique name that may not repeat.
    2. On pages where we use these fields, all 60 regions must appear.
    3. I’d like to make this easy for website editors to use if at all possible. 🙂

    What would you do?

    I’m fairly familiar with using ACF, but I keep coming up with clumsy solutions to this problem.

    So I’m wondering:

    Because you are almost certainly smarter than me, do you have a recommended solution for this?

    Thank you for any advice!

  • Unread

    New user needing a little help with date field

    I’m sure for people here this will be a no-brainer, but I’m new to ACF and not a coder, but I do have a basic knowledge of WordPress and how it works.

    I have set up a custom post type called ‘events’ and a custom field called ‘event_date’.

    I’m using Oxygen and trying to set up a repeater to query the post type ‘events’, but how do I get it to only show events on a specific day?

    Any help appreciated.

  • Unread

    Clone sub field values from relationship post

    I found this topic from 2019 which was solved. But was trying to make this work with sub fields. i.e. – What if the Events fields were repeater fields that could be populated multiple Places fields (Map/Address fields, etc.). I gave it a shot below, but I’m missing something.

    add_action('acf/save_post', 'save_event_update_address', 20);
    function save_event_update_address($post_id) {
      if (get_post_type($post_id) != 'events') {
        // not and event post, bail
      // get location post ID
      // you said it's a relationship field, a relationship field will turn an array of posts
      // I am setting the 3rd parameter because we only need the IDs
      $related_places = get_sub_field('relationship_field_name');
      // also the 
      if ($related_places) {
        $place_id = $related_places[0];
        $address = get_field('address_field_on_place_name', $place_id);
        update_sub_field('address_field_on_event_repeater_name, $address, $post_id);
  • Solved

    Override issue when repeater is populated both via backend and frontend

    I use a repeater field for creating a visitor list:

        First Name    Last Name
    1   John          Miller
    2   Tom           Brown
    3   Mike          Smith

    My field can be populated in two ways:

    1. via the WordPress backend (when I edit the post containing the field)
    2. via a form in the frontend of my site (I use the add_row() function when the form is submitted.)

    My problem:

    • I edit the related post in the WordPress backend. There, I see a list of 3 visitors.
    • In the meantime, someone enters a 4th visitor via the frontend form. The 4th visitor is saved to the DB.
    • If I refreshed my page in the backend, I would see that a 4th visitor was added. Fine!
    • But if I don’t refresh my page in the backend (i.e. I still see the list of 3 visitors) and hit the post “Update” button, the list of 3 visitors is saved and overrides the list that actually contains 4 visitors. The 4th visitor is lost.

    So, my question is:
    How can I prevent this? How can I check if new entries were added to the list before it is saved? I guess, I could use the acf/update_value filter or the acf/save_post action – but I don’t know how.

    Thanks a lot,

  • Unread

    How to Target ACF Edit Page?

    We have a PHP snippet that is being deployed using the Woody Snippets plugin. The code works great and does what it needs to do, which is to populate an ACF text field when the ACF form is saved or updated on the backend.

    But, that snippet is set to “run everywhere” because the only other option within Woody Snippets is to add it to a post or page via a shortcode. We don’t know how to add a shortcode (and have it execute) on an ACF/custom post type form on the back-end.

    The question: How could we edit the snippet (below) to only execute when someone is editing our custom post type on the back-end? We need this because running the snippet everywhere is breaking the Elementor editor, so we’re unable to edit the custom post template.

    Hope that makes sense! Here’s our snippet, if it matters:

    // This populates and saves search terms for product landing pages based on what lives in the product tables
    function save_search_terms( $post_id ) {
        $searchterms = array();
        if( have_rows('product_table') ):
        while( have_rows('product_table') ) : the_row();
        // Loop over sub repeater rows        
            if( have_rows('product_table_products') ):
                while( have_rows('product_table_products') ) : the_row();
        // Get sub value
        foreach( $tempsearchterms as $tempsearchterm );
            $tempsearchterm = get_sub_field('product_table_product');
                $searchterms[] = $tempsearchterm->part_number . " " . $tempsearchterm->product_name . " " . $tempsearchterm->model_type;
        // update field
        update_field('search_terms', implode(' ', $searchterms) );
    add_action('acf/save_post', 'save_search_terms');
        <style type="text/css">
            #search-terms {
            pointer-events: none;
  • Helping

    How to transfer form Gutenberg-Block to another ACF-Field


    I have registered an ACF field as a Gutenberg-Block.

    add_action('acf/init', 'my_acf_init');
    function my_acf_init() {  
        if( function_exists('acf_register_block_type') ) {
                'name'                => 'event-date',
                'title'                => __('Veranstaltungs-Datum'),
                'description'            => __('Veranstaltungs-Datum'),
                'render_template'   => 'block-rendering/events_date.php',
                'icon'                => 'format-image',
                'keywords'            => array( 'Event' ),
                'mode'                 => 'edit',
                'supports'          => array('multiple' => false, 'className' => true ), 
                'post_types' => array('events',),

    It is a repeater field with a date picker (and other fields).
    Is there a way to automatically transfer the date from the Gutenberg block to another ACF field (not registered as a block)?

    Thank you all!

Viewing 25 results - 1 through 25 (of 268 total)