Support

Account

Home Forums Search Search Results for 'save limit'

Search Results for 'save limit'

reply

  • The main problem here is that there is no way at all, using WP_Query to match up the values represented by the % pattern in your field names. So for example, it will match if the combination of awards_given_1_year, awards_given_2_program and awards_given_3_level meet the requirements.

    The number of queries you’d need to do with WP_Query would be uncountable.

    It might be possible to remove the % and add enough meta_query conditions to do the work, but this would in all likelihood, time out the page.

    This cannot even be done with a single query using $wpdb, because there is no single MySQL query that can be constructed to do the work. I have looked into this, and have asked the question in various places, including here https://dba.stackexchange.com/questions/118271/matching-same-unknown-characters-in-two-columns, knowing that I would probably never get an answer to the question, but not wanting to give up on the idea.

    Anyway, I just wanted to give you a little background on the difficulty of doing this type of querying.

    This is how I solve the question. 1st thing is that I never use repeaters for anything that I may want to search on if I can help it at all. I will spend days looking at alternate solutions. I’m pretty sure that this is too late for your current project because I’m pretty sure that this question reminds me of previous questions here related to the same type of setup of fields.

    2nd, if I must use a repeater and cannot find another solution, or for some reason it’s too late to change it, then what I do is I create an acf/save_post filter that gets the values from the repeater and puts them into a form that is searchable by much simpler methods.

    
    // priority 20 is after ACF is done
    add_action('acf/save_post', 'convert_repeater_to_wp', 20);
    
    function convert_repeater_to_wp($post_id) {
      if (get_post_type($post_id) != 'profile') {
        // not the right post type
        return;
      }
      // create a meta key to store the new values under
      $meta_key = 'combined_awards_given_repeater'
      // clear all of the existing values for the field before adding new values
      // to make sure it's update correctly
      delete_post_meta($post_id, $meta_key);
      // now we add the values of the repeater to this field
      if (have_rows('awards_given')) {
        while(have_rows('awards_given')) {
          $value = get_sub_field('year').' '.
                     get_sub_field('program').' '.
                     get_sub_field('level');
          add_post_meta($post_id, $meta_key, $value, false);
          // the last value "false" tells WP that this meta key can have multiple values
        } // end while have rows
      } // end if have rows
    } // end function
    

    with the above function in place you can now alter your query to

    
    $args = array(
      'posts_per_page'  => -1,
      'post_type'    => 'profiles',
      'meta_query'  => array(
        array(
          'key'    => 'combined_awards_given_repeater',
          'compare'  => '=',
          'value'    => '2017 Media Relations GRAND PRIZE',
        )
      )
    );
    

    the only hurdle you have is getting the existing values into this field. You can either manually open and update every post if the number is limited… or you can build a cron to do the work by getting every post of the post type, looping through them all and doing the same thing that the function does for every post.

  • I ended up using a sligtily modified version. You have to place this code in your functions.php and have to save each individual post in order to show/update your featured image (unfortunately, if you already have many posts this may prove to be a tedious task). Make sure you run these functions only for the custom post types you need.

    
    
    add_action('acf/save_post', 'flex_CustomExcerptSetByACF', 50);
    
    function flex_CustomExcerptSetByACF() {
    
        global $post;
    
        $post_id        = ( $post->ID ); // Current post ID
        $post_excerpt   = get_field( 'post_excerpt', $post_id ); // ACF field
    
        if ( ( !empty( $post_id ) ) AND ( $post_excerpt ) ) {
    
            $post_array     = array(
    
                'ID'            => $post_id,
                'post_excerpt'	=> $post_excerpt
    
            );
    
            remove_action('save_post', 'flex_CustomExcerptSetByACF', 50); // Unhook this function so it doesn't loop infinitely
    
            wp_update_post( $post_array );
    
            add_action( 'save_post', 'flex_CustomExcerptSetByACF', 50); // Re-hook this function
    
        }
    
    }
    
    add_action('acf/save_post', 'flex_FeaturedImageSetByACF', 50);
    
    function flex_FeaturedImageSetByACF() {
    
        $current_screen         = get_current_screen(); // Current admin screen needed to identify the current cpt
        $current_cpt_name       = $current_screen->post_type; // Current cpt name
        $current_cpt_support    = 'thumbnail'; // We want to check if the CPT supports this feature
    
        global $post;
    
        $post_id                = ( $post->ID ); // Current post ID
        $post_image_field       = get_field('post_head_img', $post_id ); // ACF field
    
        if  ( !empty( $post_id ) ) {
    
            if ( !empty( $post_image_field ) ) {
    
                $post_image_id          = $post_image_field['id']; // ACF image filed ID
                $post_image_url         = $post_image_field['url']; // ACF image filed URL
    
                // If current cpt supports thumbnails/featured images
    
                if ( post_type_supports( $current_cpt_name, $current_cpt_support ) ) {
    
                    if ( ( $post_image_url ) AND ( ( $post_image_url ) != ( get_the_post_thumbnail() ) ) ) {
    
                        update_post_meta($post_id, '_thumbnail_id', $post_image_id);
    
                    }
    
                }
    
            } else {
    
                update_post_meta( $post_id, '_thumbnail_id', 0 );
    
            }
    
        }
    
    }
    
    

    On a side note, if your issue is limited to showing exceprt & featured images on certain template files, it may prove easier to edit these.

  • ACF is a plugin that is designed for developers that build custom themes. There are other plugins available for those that are not coders, for example Pods or the Types Toolkit. There are really very few “hooks” outside of the “the_content” where ACF fields could be inserted and without building custom HTML to contain the values saved in the fields ACF, anything that could be built would be extremely basic and limiting. It depends on what you’re looking for. If you’re not a coder and don’t have any interest in doing any coding then you’re probably not looking for something like ACF.

  • Thanks, i think i’m limited in PHP to do that… I never work with save_post action and concatenation of fields. I continue to try.

  • Kind of annoying that this still has not been implemented after almost 3.5 years, but for what it’s worth: +1

    Meanwhile I modified Beee’s solution to accept more than one value as I needed it to work with checkboxes.

    I’m sure someone more experienced can improve on this, but here it is for now:

    
    function change_post_taxonomy( $post_id ) {
        // bail if no ACF data
        if ( empty($_POST['acf']) ) {
            return;
        }
        
        // Limit to certain post types if needed
        if(get_post_type($post_id) == 'whatever') {
    	    
    	    $term_ids = array();
    		
    	    // get term id from $post_id
    	    $stored_role = wp_get_post_terms($post_id, 'category');
    	    
    	    // get submitted value from acf form by field key
    	    $posted_roles = $_POST['acf']['field_582c317422b74'];
    	    
    	    // get term_id for the submitted value(s)	    
    	    foreach ($posted_roles as $posted_role) { 
    			
    			$term = get_term_by( 'name', $posted_role, 'category' );
    			$term_id = $term->term_id;
    			$term_ids[] = $term_id;
    		
    		}
    	    
    	    // if stored value(s) is/are not equal to posted value(s), then update terms
    	    if ( $stored_role != $posted_role ) {
    	        wp_set_object_terms( $post_id, $term_ids, 'category' );
    	    }
        }
    }
    add_action('acf/save_post', 'change_post_taxonomy', 20);
    
  • No solution here, just some thoughts.

    There are really 2 issues discussed in this thread. On of them is a slow admin page due to the performance of JavaScript, the other is a slow saving issue. While it may appear to many that these are the same issue, they are in fact to separate issues as far as code and what’s going on.

    The JS issue will cause the admin page to be sluggish do to the way that ACF4 tests conditional logic. ACF5 has improved this…. but if you have a highly complex field groups setup with a lot of conditional logic, you’re still probably going to see problems and a slow down.

    The second issue, slow saving. This is an issue with the way that WP updates meta values. Every update query for every field in ACF produces at least 4 DB queries. First WP checks to see if there is already a value for a field and then it updates the value for the field. Sometimes it then does a new query to get the new value and populate the cache… why it needs to do this 3rd one, HTH knows. This is done twice for each field because ACF also needs to update the field key reference for the field. This is a limitation of WP because when updating it deals with one meta field at a time. It may be possible to improve this by adding an acf/save_post filter that gets all the post meta for a post before doing an update… but I have not tested this theory. At any rate, given enough fields on a single update it is possible that the update will time out in the browser before it completes. Fixing this problem I suspect is beyond the scope of what ACF is meant to do. Now, if someone could come up with a way to bypass this one at a time field update…. I’ve thought about it but I simple don’t have the time.

    On top of both of these issues is the fact that validation of field values is done on the server using AJAX. Part of the reason for this is to allow us, the developers, to create custom validation filters. This is an extra step that means the a post is actually sent to the server twice before it’s updated.

    My solution is to consider the limitations and plan my development around those limitations. What is logically possible and what is possible in practice are not the always the same thing. If I give a user a repeater field to add images and content with I expect them to be practical and not add 10,000 images to the repeater, although I wouldn’t be surprised if they tried.

  • I think you need to actually publish or save a post for it to remember the collapsed state of the fields, but I’m not sure. It could also be that if you’re field group is extremely complex with lots of nested flex fields and repeaters that it’s confusing ACF trying to figure out what fields should be collapsed and what ones shouldn’t be. It could be a bug, or it could just be that you’ve found a limitation. Field collapsing is a relatively new feature of ACF.

  • Hi @eddr

    It’s possible that the issue is related to your max_vars variable. In this case, kindly try the solution on this page: https://www.advancedcustomfields.com/resources/limit-number-fields/.

    It’s also possible that you have a very long field name. Could you please check this page to learn more about it: https://www.advancedcustomfields.com/resources/field-value-wont-save/?

    If you want, you can also check the value in your database. It’s saved in the wp_postmeta table. Please don’t forget to backup your database if you decided to check the database.

    Another thing you can try is trying to reproduce the issue on one of the WordPress’ stock themes (like Twenty Sixteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue. This will make sure that the issue is not related to your theme or other plugins.

    Thanks 🙂

  • Hi @tadej

    Could you please make sure that the issue is not related to the max_vars variable? This page should give you more idea about it: https://www.advancedcustomfields.com/resources/limit-number-fields/.

    Also, could you please make sure that the issue is not the field name? This page should give you more idea about it: https://www.advancedcustomfields.com/resources/field-value-wont-save/.

    If you are using the Local JSON feature, could you please disable it for a while?

    If that doesn’t help, could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Sixteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue. This will make sure that no other plugins that cause this issue.

    Thanks 🙂

  • Hi @iamhexcoder

    Actually, I don’t really understand why you want to generate the fields based on the posts. Could you please explain it to me again? I think if you have a lot of posts in the future, it will make the backend looks messy. If you still want to do it, don’t forget to update your server’s max_vars variable so all of the values can be saved. This page should give you more idea about it: https://www.advancedcustomfields.com/resources/limit-number-fields/.

    Thanks 🙂

  • Hi @geert

    Hard to know where to start…

    Okay, so most people on the web with a WordPress site probably has shared hosting (I’m guessing). They have little to no control over the servers settings and limitations. Here’s some standard PHP values which are unlikely to be set higher in such shared hosting:
    http://php.net/manual/en/info.configuration.php

    disclaimer: I’m not gonna research everything here before (limited time) so some is a little bit of guesswork when it comes to numbers.

    max_input_vars there is one of the most interesting ones. Basically it says that PHP will accept a maximum of 1000 input fields to send to a single request (page load). In the case of WP admin that would likely be a POST request. WordPress per default already have quite a bit of fields for a standard edit screen. There’s a whole bunch of hidden fields as well as formats, categories, tags, featured image, title, editor, permalink, visibility, status etc. Let’s say you also have a few regular custom fields. Then you also add a repeater field to this. Each row might contain 2-10 fields + some hidden fields ACF uses to keep track of everything. Maybe you even have nested repeaters! So for each row there’s 2-10 fields + a nested repeater which in term contains 2-10 fields. And say you add in a gallery field there as well. That’s at the very least 1 field for each image.

    You’re quickly gonna find that you hit the 1000 input vars limit if you abuse repeaters. That’s gonna stop you from adding any new content to the page before you delete other. That in itself should be enough to reconsider huge repeater fields. But to make matters worse there’s also server limits like max_execution_time and max_allowed_packet (mysql). Saving all these fields will take some time and if you’re not on a great internet connection you may hit the max_excecution_time which will lead to your page save ending abruptly and unfinished. max_allowed_packet is a variable for mySQL which basically limits how large of data chunk you may insert in one go. It’s much harder to hit but it’s possible.

    If you’d be on a VPS you could prevent all of this by just upping your server stats. However you’ll still get a very slow admin experience and let’s face it, you’re patching a leaking boat and probably have to pay a hefty price for it (big servers aren’t cheap).

    Then there’s also the issue of WordPress database structure and the performance of WP_Query. 10up has written a great article on performance with WP_Query and one of the things to avoid is post meta lookup. Usually there’s no choice BUT we can at least do what we can to use simple post meta like a single date field or a boolean. And of course try to minimize the amount of post meta for each single post. https://10up.github.io/Engineering-Best-Practices/php/#performance
    Consider that ACF adds two rows to wp_postmeta for each field (both regular and sub fields).

    So if we can refactor our data structure to use a custom post type which would contain some fields and then perhaps link different posts/post types together with the post object or relationship field we’ll end up with safer and quicker admin requests, faster and often more versatile use of wp_queries in our front end and a better DB structure more fitting of WordPress strengths and weaknesses.

    It’s hard to say a number of repeater rows that’d be “too much” since it depends on what they contain. But for me, if I find that I’d end up with more than 20-30 row of simpler repeater data or 10-15 rows of more complex ones I would consider a different solution. Sometimes it’s hard to predict tho. We’ve had customers where they were supposed to use repeaters for just a few categories of Press media attachments but they ended up dumping soooo much media there that we eventually had to rebuild it for them with a CPT where each post was a single media file and a taxonomy for the categories of media.

    Hope that was a sufficient answer 🙂

  • You could add a field to use as the title and then use an acf/save_post filter to copy the value of the title into the post title. There’s an example of this here https://support.advancedcustomfields.com/forums/topic/createupdate-post-title-from-acf-fields/

    You might want to log into your account and see if you can download a copy of ACF5 Pro. At one time people that purchased one of the premium add ons were eligible for a free upgrade to Pro, but I don’t know if this is still the case, it may have been a limited time thing. But if you log into your account and you are then it will be listed in the files you can download.

  • Well, I have it working, but not the way I’d like it to, and there is still a bug in ACF Pro (current version).

    The only way I can get it to work is to change how the image is stored to as an ID.

    The bug is that regardless of how I select it to be stored (my preference would be as a URL), it stores it as an ID anyway – so changing it to Array or URL has no effect – it still just shows up in the database with an ID number.

    BUT regardless of how it is stored, unless I change that setting to *also* be “ID” then I can’t use it using the get_field function.

    The ONLY way I can get it to work is to have it set to store as an ID and use the echo wp_get_attachment_image( $imgID, $size ); method, which is not ideal because then WP adds classes and styling that I don’t want and have to override with my own styles, and I am limited to the WP image sizes (although I know I can add my own and have, but in some places I just want to add a one-off image size without having to put it in my functions first) .

    If I could just echo the URL, I can structure my own image link using my own sizes and styles and pull in whatever other author meta I want….

    Any help would still be welcomed, ideally I’d like to see the bug fixed in a future update – if the option exists to store images as an array or as a URL, it should save to the database using the selected option.

  • This is a file included in function.php

    <?php
    
    if( function_exists('acf_add_options_page') ) {
    	
    	$parent=acf_add_options_page(array(
    		'page_title' 	=> __('Opzioni tema', RDD_THEME_LANGUAGE),
    		'menu_title'	=> __('Opzioni tema', RDD_THEME_LANGUAGE),
    		'menu_slug' 	=> 'theme-settings',
    		'capability'	=> 'edit_posts',
    		'redirect'		=> false,
    	));
    
    }
    
    if( function_exists('acf_add_local_field_group') ):
    
    acf_add_local_field_group(array (
    	'key' => 'group_56deba1cbd3f5',
    	'title' => 'Opzioni tema',
    	'fields' => array (
    		array (
    			'key' => 'field_56e1311b8a152',
    			'label' => 'Header',
    			'name' => 'header',
    			'type' => 'tab',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'placement' => 'left',
    			'endpoint' => 0,
    		),
    		array (
    			'key' => 'field_56ded92b9fac1',
    			'label' => 'Testo del logo',
    			'name' => 'logo_text',
    			'type' => 'text',
    			'instructions' => 'Sarà utilizzato se non selezioni nessun\'immagine del logo qui sotto.',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
    			'prepend' => '',
    			'append' => '',
    			'maxlength' => '',
    			'readonly' => 0,
    			'disabled' => 0,
    		),
    		array (
    			'key' => 'field_56ded9439fac2',
    			'label' => 'Immagine logo',
    			'name' => 'logo_image',
    			'type' => 'image',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'return_format' => 'array',
    			'preview_size' => 'scale-half-wide',
    			'library' => 'all',
    			'min_width' => '',
    			'min_height' => '',
    			'min_size' => '',
    			'max_width' => '',
    			'max_height' => '',
    			'max_size' => '',
    			'mime_types' => '',
    		),
    		array (
    			'key' => 'field_56e185ed2619a',
    			'label' => 'Immagine logo mini',
    			'name' => 'logo_image_mini',
    			'type' => 'image',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'return_format' => 'array',
    			'preview_size' => 'scale-half-wide',
    			'library' => 'all',
    			'min_width' => '',
    			'min_height' => '',
    			'min_size' => '',
    			'max_width' => '',
    			'max_height' => '',
    			'max_size' => '',
    			'mime_types' => '',
    		),
    		array (
    			'key' => 'field_56ded96c9fac3',
    			'label' => 'Tagline',
    			'name' => 'tagline',
    			'type' => 'text',
    			'instructions' => 'Per inserire spazio unificatore tra le parole, usare il segno_ (senza spazi).',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => 'Il primo social magazine per sole donne...',
    			'prepend' => '',
    			'append' => '',
    			'maxlength' => '',
    			'readonly' => 0,
    			'disabled' => 0,
    		),
    		array (
    			'key' => 'field_56ded7ba9fabf',
    			'label' => 'Apparenza',
    			'name' => '',
    			'type' => 'tab',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'placement' => 'left',
    			'endpoint' => 0,
    		),
    		array (
    			'key' => 'field_56deba313957c',
    			'label' => 'Colore principale',
    			'name' => 'main_color',
    			'type' => 'color_picker',
    			'instructions' => '',
    			'required' => 1,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '#fc5356',
    		),
    		array (
    			'key' => 'field_56dedc3bf9827',
    			'label' => 'Colore secondario :hover',
    			'name' => 'hover_color',
    			'type' => 'color_picker',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '#BD3539',
    		),
    		array (
    			'key' => 'field_56dedc96f9829',
    			'label' => 'Colore secondario :active',
    			'name' => 'active_color',
    			'type' => 'color_picker',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '#BD3539',
    		),
    		array (
    			'key' => 'field_56dedc6ef9828',
    			'label' => 'Colore secondario :focus',
    			'name' => 'focus_color',
    			'type' => 'color_picker',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '#BD3539',
    		),
    		array (
    			'key' => 'field_56dedcaef982a',
    			'label' => 'Colore secondario :visited',
    			'name' => 'visited_color',
    			'type' => 'color_picker',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '#BD3539',
    		),
    		array (
    			'key' => 'field_56ded6c8b4ee4',
    			'label' => 'Immagine della favicon',
    			'name' => 'favicon_image',
    			'type' => 'image',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'return_format' => 'url',
    			'preview_size' => 'detail',
    			'library' => 'all',
    			'min_width' => '',
    			'min_height' => '',
    			'min_size' => '',
    			'max_width' => '',
    			'max_height' => '',
    			'max_size' => '',
    			'mime_types' => '',
    		),
    		array (
    			'key' => 'field_56dxd9c9fac4',
    			'label' => 'Single page',
    			'name' => 'single_page',
    			'type' => 'tab',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'placement' => 'left',
    			'endpoint' => 0,
    		),
    		array (
    			'key' => 'field_52dec9a29fac40',
    			'label' => 'Post correlati Header',
    			'name' => 'related_enable_header',
    			'type' => 'radio',
    			'instructions' => "Abilita o meno la sezione correlati nell'header",
    			'required' => 1,
    			'conditional_logic' => 0,
    			'choices' => array (
    				1 => 'Abilitato',
    				0 => 'Disabilitato',
    			),
    			'other_choice' => 0,
    			'save_other_choice' => 0,
    			'default_value' => 1,
    			'layout' => 'vertical',
    		),
    		array (
    			'key' => 'field_52dec9ac9fdc41',
    			'label' => 'Post correlati Sidebar',
    			'name' => 'related_enable_sidebar',
    			'type' => 'radio',
    			'instructions' => 'Abilita o meno la sezione correlati nella sidebar',
    			'required' => 1,
    			'conditional_logic' => 0,
    			'choices' => array (
    				1 => 'Abilitato',
    				0 => 'Disabilitato',
    			),
    			'other_choice' => 0,
    			'save_other_choice' => 0,
    			'default_value' => 1,
    			'layout' => 'vertical',
    		),
    		array (
    			'key' => 'field_52dec9av9fac4p',
    			'label' => 'Altezza sticky-ads Sidebar',
    			'name' => 'ads_sidebar_height',
    			'type' => 'text',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'default_value' => '1500',
    			'placeholder' => '1500',
    			'prepend' => '',
    			'append' => 'px',
    			'maxlength' => '',
    			'readonly' => 0,
    			'disabled' => 0,
    		),
    		array (
    			'key' => 'field_12dec9a2vfac43',
    			'label' => 'Infinite Loops Paginazione Articolo',
    			'name' => 'infinite_loops_single_pagination',
    			'type' => 'radio',
    			'instructions' => '',
    			'required' => 1,
    			'conditional_logic' => 0,
    			'choices' => array (
    				true => 'Abilitato',
    				0 => 'Disabilitato',
    			),
    			'other_choice' => 0,
    			'save_other_choice' => 0,
    			'default_value' => 1,
    			'layout' => 'vertical',
    		),
    		array (
    			'key' => 'field_52dec9a29bac44',
    			'label' => 'Infinite Loops Prossimo Articolo',
    			'name' => 'infinite_loops_single_next',
    			'type' => 'radio',
    			'instructions' => '',
    			'required' => 1,
    			'conditional_logic' => 0,
    			'choices' => array (
    				1 => 'Abilitato',
    				0 => 'Disabilitato',
    			),
    			'other_choice' => 0,
    			'save_other_choice' => 0,
    			'default_value' => 1,
    			'layout' => 'vertical',
    		),
    		array (
    			'key' => 'field_55dod9o29fbx0',
    			'label' => 'Lazy Load',
    			'name' => 'lazy_load',
    			'type' => 'tab',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'placement' => 'left',
    			'endpoint' => 0,
    		),
    		array (
    			'key' => 'field_55dod9o29fbx1',
    			'label' => 'Homepage',
    			'name' => 'lazy_load_home_active',
    			'type' => 'radio',
    			'instructions' => 'Abilita o meno il lazy load nella Homepage',
    			'required' => 1,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'choices' => array (
    				1 => 'on',
    				0 => 'off',
    			),
    			'other_choice' => 0,
    			'save_other_choice' => 0,
    			'default_value' => 1,
    			'layout' => 'vertical',
    		),
    		array (
    			'key' => 'field_55dod9o29fbx2',
    			'label' => 'Single page',
    			'name' => 'lazy_load_single_active',
    			'type' => 'radio',
    			'instructions' => 'Abilita o meno il lazy load nelle single pages',
    			'required' => 1,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'choices' => array (
    				1 => 'on',
    				0 => 'off',
    			),
    			'other_choice' => 0,
    			'save_other_choice' => 0,
    			'default_value' => 1,
    			'layout' => 'vertical',
    		),
    		array (
    			'key' => 'field_55dod9o29fbx3',
    			'label' => 'Archivi',
    			'name' => 'lazy_load_archives_active',
    			'type' => 'radio',
    			'instructions' => 'Abilita o meno il lazy load nelle single pages',
    			'required' => 1,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'choices' => array (
    				1 => 'on',
    				0 => 'off',
    			),
    			'other_choice' => 0,
    			'save_other_choice' => 0,
    			'default_value' => 1,
    			'layout' => 'vertical',
    		),
    		array (
    			'key' => 'field_56dede4aa7bf1',
    			'label' => 'Social',
    			'name' => 'social',
    			'type' => 'tab',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'placement' => 'left',
    			'endpoint' => 0,
    		),
    		array (
    			'key' => 'field_56dede59a7bf2',
    			'label' => 'Facebook url',
    			'name' => 'profile_url_facebook',
    			'type' => 'url',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => 'https://www.facebook.com/robadadonne',
    		),
    		array (
    			'key' => 'field_56dede92a7bf3',
    			'label' => 'Twitter url',
    			'name' => 'profile_url_twitter',
    			'type' => 'url',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => 'https://twitter.com/robadadonne',
    		),
    		array (
    			'key' => 'field_56e96308c7a7a',
    			'label' => 'Twitter via',
    			'name' => 'profile_via_twitter',
    			'type' => 'text',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
    			'prepend' => '@',
    			'append' => '',
    			'maxlength' => '',
    			'readonly' => 0,
    			'disabled' => 0,
    		),
    		array (
    			'key' => 'field_56e9633ec7a7b',
    			'label' => 'Twitter hashtags',
    			'name' => 'profile_hastags_twitter',
    			'type' => 'text',
    			'instructions' => 'Separa gli hastags con una virgola',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '#example, #demo',
    			'prepend' => '',
    			'append' => '',
    			'maxlength' => '',
    			'readonly' => 0,
    			'disabled' => 0,
    		),
    		array (
    			'key' => 'field_56dededba7bf4',
    			'label' => 'Pinterest url',
    			'name' => 'profile_url_pinterest',
    			'type' => 'url',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => 'https://www.pinterest.com/robadadonne/',
    		),
    		array (
    			'key' => 'field_56dedef3a7bf5',
    			'label' => 'Instagram url',
    			'name' => 'profile_url_instagram',
    			'type' => 'url',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => 'https://www.instagram.com/robadadonne/',
    		),
    		array (
    			'key' => 'field_56dedf1ba7bf6',
    			'label' => 'Google+ url',
    			'name' => 'profile_url_googleplus',
    			'type' => 'url',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => 'https://plus.google.com/+RobadadonneIt',
    		),
    		array (
    			'key' => 'field_56dedf70a7bf7',
    			'label' => 'Youtube url',
    			'name' => 'profile_url_youtube',
    			'type' => 'url',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => 'https://www.youtube.com/channel/UCd5_RNvJvPT7KoOqDwCRlew',
    		),
    		array (
    			'key' => 'field_56dedb41fdb37',
    			'label' => 'Under Construction',
    			'name' => 'underconstruction',
    			'type' => 'tab',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'placement' => 'left',
    			'endpoint' => 0,
    		),
    		array (
    			'key' => 'field_56dedb87fdb38',
    			'label' => 'Under Construction Active',
    			'name' => 'underconstruction_active',
    			'type' => 'radio',
    			'instructions' => 'Si può scegliere di inviare il codice di stato HTTP standard con la pagina in costruzione, o inviare un codice di stato "Servizio non disponibile" 503. Questo dirà a Google che questa pagina non è ancora pronta fino a quando questo plugin è disabilitato.
    Inoltre è possibile selezionare quali ruoli utente possono accedere al sito quando "Under Construction" è attivo. 
    NB. Administrator è sempre attivo',
    			'required' => 1,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'choices' => array (
    				1 => 'on',
    				0 => 'off',
    			),
    			'other_choice' => 0,
    			'save_other_choice' => 0,
    			'default_value' => 0,
    			'layout' => 'vertical',
    		),
    		array (
    			'key' => 'field_56e131708a153',
    			'label' => 'HTTP Status Code',
    			'name' => 'underconstrunction_http_status_code',
    			'type' => 'radio',
    			'instructions' => 'Si può scegliere di inviare il codice di stato HTTP standard con la pagina in costruzione, o inviare un codice di stato "Servizio non disponibile" 503. Questo dirà a Google che questa pagina non è ancora pronta fino a quando questo plugin è disabilitato.',
    			'required' => 0,
    			'conditional_logic' => array (
    				array (
    					array (
    						'field' => 'field_56dedb87fdb38',
    						'operator' => '==',
    						'value' => '1',
    					),
    				),
    			),
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'choices' => array (
    				200 => 'HTTP 200 - ok',
    				301 => 'HTTP 301 - Redirect',
    				503 => 'HTTP 503 - Service Unavailable',
    			),
    			'other_choice' => 0,
    			'save_other_choice' => 0,
    			'default_value' => 200,
    			'layout' => 'vertical',
    		),
    		array (
    			'key' => 'field_56e132558a154',
    			'label' => 'Redirect Location',
    			'name' => 'underconstruction_redirect_location',
    			'type' => 'url',
    			'instructions' => '',
    			'required' => 1,
    			'conditional_logic' => array (
    				array (
    					array (
    						'field' => 'field_56dedb87fdb38',
    						'operator' => '==',
    						'value' => '1',
    					),
    					array (
    						'field' => 'field_56e131708a153',
    						'operator' => '==',
    						'value' => '301',
    					),
    				),
    			),
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
    		),
    		array (
    			'key' => 'field_56e137ff8adf7',
    			'label' => 'Display Options',
    			'name' => 'underconstruction_display_options',
    			'type' => 'radio',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => array (
    				array (
    					array (
    						'field' => 'field_56dedb87fdb38',
    						'operator' => '==',
    						'value' => '1',
    					),
    					array (
    						'field' => 'field_56e131708a153',
    						'operator' => '==',
    						'value' => '200',
    					),
    				),
    			),
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'choices' => array (
    				0 => 'Visualizza la pagina in costruzione di default',
    				1 => 'Visualizza la pagina in costruzione di default, ma utilizza del testo personalizzato',
    				2 => 'Visualizza una pagina personalizzata utilizzando il proprio codice HTML',
    			),
    			'other_choice' => 0,
    			'save_other_choice' => 0,
    			'default_value' => 0,
    			'layout' => 'vertical',
    		),
    		array (
    			'key' => 'field_56e138b28adf8',
    			'label' => 'Visualizza la pagina in costruzione di default, ma utilizza del testo personalizzato',
    			'name' => 'underconstruction_display_options_1',
    			'type' => 'repeater',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => array (
    				array (
    					array (
    						'field' => 'field_56dedb87fdb38',
    						'operator' => '==',
    						'value' => '1',
    					),
    					array (
    						'field' => 'field_56e137ff8adf7',
    						'operator' => '==',
    						'value' => '1',
    					),
    				),
    			),
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'collapsed' => 'field_56e139288adfa',
    			'min' => 1,
    			'max' => 1,
    			'layout' => 'row',
    			'button_label' => '',
    			'sub_fields' => array (
    				array (
    					'key' => 'field_56e17865c0d2f',
    					'label' => 'Colore background',
    					'name' => 'underconstruction_page_color_background',
    					'type' => 'color_picker',
    					'instructions' => '',
    					'required' => 0,
    					'conditional_logic' => 0,
    					'wrapper' => array (
    						'width' => '',
    						'class' => '',
    						'id' => '',
    					),
    					'default_value' => '#FF5553',
    				),
    				array (
    					'key' => 'field_56e178c9c0d30',
    					'label' => 'Immagine background',
    					'name' => 'underconstruction_page_image_background',
    					'type' => 'image',
    					'instructions' => '',
    					'required' => 0,
    					'conditional_logic' => 0,
    					'wrapper' => array (
    						'width' => '',
    						'class' => '',
    						'id' => '',
    					),
    					'return_format' => 'url',
    					'preview_size' => 'scale-half-wide',
    					'library' => 'all',
    					'min_width' => '',
    					'min_height' => '',
    					'min_size' => '',
    					'max_width' => '',
    					'max_height' => '',
    					'max_size' => '',
    					'mime_types' => '',
    				),
    				array (
    					'key' => 'field_56e139288adfa',
    					'label' => 'Page Title',
    					'name' => 'underconstruction_page_title',
    					'type' => 'text',
    					'instructions' => '',
    					'required' => 0,
    					'conditional_logic' => 0,
    					'wrapper' => array (
    						'width' => '',
    						'class' => '',
    						'id' => '',
    					),
    					'default_value' => '',
    					'placeholder' => '',
    					'prepend' => '',
    					'append' => '',
    					'maxlength' => '',
    					'readonly' => 0,
    					'disabled' => 0,
    				),
    				array (
    					'key' => 'field_56e139438adfb',
    					'label' => 'Header Text',
    					'name' => 'underconstruction_page_header',
    					'type' => 'text',
    					'instructions' => '',
    					'required' => 0,
    					'conditional_logic' => 0,
    					'wrapper' => array (
    						'width' => '',
    						'class' => '',
    						'id' => '',
    					),
    					'default_value' => '',
    					'placeholder' => '',
    					'prepend' => '',
    					'append' => '',
    					'maxlength' => '',
    					'readonly' => 0,
    					'disabled' => 0,
    				),
    				array (
    					'key' => 'field_56e139578adfc',
    					'label' => 'Body Text',
    					'name' => 'underconstruction_page_body',
    					'type' => 'textarea',
    					'instructions' => '',
    					'required' => 0,
    					'conditional_logic' => 0,
    					'wrapper' => array (
    						'width' => '',
    						'class' => '',
    						'id' => '',
    					),
    					'default_value' => '',
    					'placeholder' => '',
    					'maxlength' => '',
    					'rows' => 3,
    					'new_lines' => 'wpautop',
    					'readonly' => 0,
    					'disabled' => 0,
    				),
    			),
    		),
    		array (
    			'key' => 'field_56e1397f8adfd',
    			'label' => 'Under Construction Pagina HTML',
    			'name' => 'underconstruction_display_options_2',
    			'type' => 'textarea',
    			'instructions' => 'Mettere in questa zona il codice HTML che si desidera visualizzare sulla vostra pagina anteriore',
    			'required' => 0,
    			'conditional_logic' => array (
    				array (
    					array (
    						'field' => 'field_56dedb87fdb38',
    						'operator' => '==',
    						'value' => '1',
    					),
    					array (
    						'field' => 'field_56e137ff8adf7',
    						'operator' => '==',
    						'value' => '2',
    					),
    				),
    			),
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
    			'maxlength' => '',
    			'rows' => '',
    			'new_lines' => '',
    			'readonly' => 0,
    			'disabled' => 0,
    		),
    		array (
    			'key' => 'field_56e132988a155',
    			'label' => 'Limiti di ruolo',
    			'name' => 'underconstruction_roles',
    			'type' => 'select',
    			'instructions' => 'Seleziona il gruppo di utenti che possono accedere al sito quando "Under Construction" è attivo. 
    NB. Administrator è sempre attivo',
    			'required' => 0,
    			'conditional_logic' => array (
    				array (
    					array (
    						'field' => 'field_56dedb87fdb38',
    						'operator' => '==',
    						'value' => '1',
    					),
    				),
    			),
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'choices' => array (
    				'administrator' => 'administrator',
    				'author' => 'author',
    				'contributor' => 'contributor',
    				'editor' => 'editor',
    				'redattore' => 'redattore',
    				'subscriber' => 'subscriber',
    				'bbp_keymaster' => 'bbp_keymaster',
    				'bbp_moderator' => 'bbp_moderator',
    				'bbp_participant' => 'bbp_participant',
    				'bbp_spectator' => 'bbp_spectator',
    				'bbp_blocked' => 'bbp_blocked',
    			),
    			'default_value' => array (
    			),
    			'allow_null' => 0,
    			'multiple' => 1,
    			'ui' => 0,
    			'ajax' => 0,
    			'placeholder' => '',
    			'disabled' => 0,
    			'readonly' => 0,
    		),
    		array (
    			'key' => 'field_56ded9af9fac5',
    			'label' => 'Avanzato',
    			'name' => '',
    			'type' => 'tab',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'placement' => 'left',
    			'endpoint' => 0,
    		),
    		array (
    			'key' => 'field_56ded9c59fac6',
    			'label' => 'Codice CSS Personalizzato',
    			'name' => 'custom_css',
    			'type' => 'textarea',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
    			'maxlength' => '',
    			'rows' => '',
    			'new_lines' => '',
    			'readonly' => 0,
    			'disabled' => 0,
    		),
    		array (
    			'key' => 'field_56ded9dc9fac7',
    			'label' => 'Codice Javascript personalizzato',
    			'name' => 'custom_js',
    			'type' => 'textarea',
    			'instructions' => '',
    			'required' => 0,
    			'conditional_logic' => 0,
    			'wrapper' => array (
    				'width' => '',
    				'class' => '',
    				'id' => '',
    			),
    			'default_value' => '',
    			'placeholder' => '',
    			'maxlength' => '',
    			'rows' => '',
    			'new_lines' => '',
    			'readonly' => 0,
    			'disabled' => 0,
    		),
    	),
    	'location' => array (
    		array (
    			array (
    				'param' => 'options_page',
    				'operator' => '==',
    				'value' => 'theme-settings',
    			),
    		),
    	),
    	'menu_order' => 0,
    	'position' => 'acf_after_title',
    	'style' => 'default',
    	'label_placement' => 'left',
    	'instruction_placement' => 'field',
    	'hide_on_screen' => '',
    	'active' => 1,
    	'description' => '',
    ));
    
    endif;
    
    function acf_load_underconstruction_roles_field_choices( $field ) {
        $field['choices'] = array();
        global $wp_roles;
    	$roles = $wp_roles->roles;
    	foreach($roles as $k=>$role){
    		 $field['choices'][ $k ] = $k;
    	}
        return $field;
        
    }
    add_filter('acf/load_field/name=underconstruction_roles', 'acf_load_underconstruction_roles_field_choices');
    
    /* UNDER CONSTRUCTION */
    if(function_exists('get_field')){
    	add_action('template_redirect', array("underConstruction", 'uc_overrideWP'));
    	add_action('admin_init', array("underConstruction", 'uc_admin_override_WP'));
    	add_action('wp_login', array("underConstruction", 'uc_admin_override_WP'));
    }

    I had the same problem in past with another fields (I don’t remember what fields), I just delete the field group from acf option page and I exported it in php.
    I have a wordpress multisite blog using bedrock/sage theme

  • Ah I see..
    Yeah I understand your setup now.Unfortunately your issue remains that at some point you’re gonna run into server-limitations.

    The thing about acf_form and manipulating the output would be that it’d affect the repeater field when you save the changes.

    You could probably hide all but the last 5 rows in the form using CSS but that’s a dirty fix.

    So now that I know a bit more and also your requirements here’s what I’d rather do.

    I would create a new CPT called events. Then setup a new field on each company report which is a relationship field for the events posts. You can have this field in your original acf_form is you like just to be able to remove/add posts that already exists.

    Now you say you don’t want your analysts to jump from a single view.
    Well you can create a separate acf_form on the same page with just the fields for each event which when posted creates a new event which automatically connects to the relationship field for the report (you code this yourself, very simple).

    This would also allow you to manually query all events or maybe just the latest 5-10 to display to your analysts. You can also provide an edit-button for each event. This gives you the ability to separate older events from newer in whatever fashion you want. You could also prevent editing of older events by only allowing events from the past month to be edited (for example).

    Anyway, here’s that dirty CSS fix as well.. You’ll have to change “<yourkey>” to the key of the repeater field. This assumes you’ve set your repeater to display as row.

    
    .acf-field-<yourkey> .acf-table tbody .acf-row{
    	display: none;
    	
    }
    
    .acf-field-<yourkey> .acf-table tbody .acf-row:last-child,
    .acf-field-<yourkey> .acf-table tbody .acf-row:nth-last-child(2),
    .acf-field-<yourkey> .acf-table tbody .acf-row:nth-last-child(3),
    .acf-field-<yourkey> .acf-table tbody .acf-row:nth-last-child(4),
    .acf-field-<yourkey> .acf-table tbody .acf-row:nth-last-child(5) {
    	display: table-row;
    
    }
    
  • What type of users will be using this front end form? Have you tried logging into your site as that type of user? Does that type of user have access to the media library? If not then the gallery field isn’t going to work for them and you’ll need to provide them with an alternate to the gallery.

    Assuming that they do have access to the media library you can limit the images that they see to only the ones they uploaded by using a pre_get_posts filter.

    
    add_filter('pre_get_posts', 'limit_gallery_to_user');
    function limit_gallery_to_user($query) {
      if (is_admin() || 
          !isset($query->query_vars['post_type']) ||
          $query->query_vars['post_type'] != 'attachment') {
        return;
      }
      $user_id = get_current_user_id();
      $query->set('author', $user_id);
    }
    

    If they don’t have access to the medial library and the gallery does not work you will probably need to use a repeater field with image fields and then transfer the images to the gallery using an acf/save_post filter.

  • Hi @rinalds

    It’s possible that you have a long field name. Please take a look at this page: http://www.advancedcustomfields.com/resources/field-value-wont-save/.

    It’s also possible that your server has settings that prevent the saving process. This page should give you more idea about it: http://www.advancedcustomfields.com/resources/limit-number-fields/.

    Could you also do a test on a WordPress’ stock theme like Twenty fifteen?

    Thanks!

  • Hi @tdmalone,
    Yes, I was just sharing my experience with this issue as well. Regarding your issue, have you looked at the wp_options table to increase the options_name character length? See here: Link

    Another possible similar issue was addressed using the .htaccess file and increasing the php memory limit. See here: Link

    Please let me know if any of this helps.

  • sorry, prematurely submitted that. Let’s try again.

    I set up a field group using the code as a reference and inserted your code into the template without making any changes to it. The result of my test is here: http://www.ssird7.com.php53-14.dfw1-2.websitetestlink.com/2015/08/18/hello-world/ and it’s working for me.

    Here is the exported field group I created:

    
    <?php 
    
    if(function_exists("register_field_group"))
    {
      register_field_group(array (
        'id' => 'acf_test-group',
        'title' => 'test group',
        'fields' => array (
          array (
            'key' => 'field_56aaccc8f9a22',
            'label' => 'downloads',
            'name' => 'downloads',
            'type' => 'repeater',
            'sub_fields' => array (
              array (
                'key' => 'field_56aacd07f9a23',
                'label' => 'downloads_title',
                'name' => 'downloads_title',
                'type' => 'text',
                'column_width' => '',
                'default_value' => '',
                'placeholder' => '',
                'prepend' => '',
                'append' => '',
                'formatting' => 'html',
                'maxlength' => '',
              ),
              array (
                'key' => 'field_56aacd10f9a24',
                'label' => 'documents',
                'name' => 'documents',
                'type' => 'repeater',
                'column_width' => '',
                'sub_fields' => array (
                  array (
                    'key' => 'field_56aacd30f9a25',
                    'label' => 'document_upload',
                    'name' => 'document_upload',
                    'type' => 'file',
                    'column_width' => '',
                    'save_format' => 'object',
                    'library' => 'all',
                  ),
                  array (
                    'key' => 'field_56aaceeb47f43',
                    'label' => 'document_name',
                    'name' => 'document_name',
                    'type' => 'text',
                    'column_width' => '',
                    'default_value' => '',
                    'placeholder' => '',
                    'prepend' => '',
                    'append' => '',
                    'formatting' => 'html',
                    'maxlength' => '',
                  ),
                ),
                'row_min' => '',
                'row_limit' => '',
                'layout' => 'row',
                'button_label' => 'Add Row',
              ),
            ),
            'row_min' => '',
            'row_limit' => '',
            'layout' => 'row',
            'button_label' => 'Add Row',
          ),
        ),
        'location' => array (
          array (
            array (
              'param' => 'post_type',
              'operator' => '==',
              'value' => 'post',
              'order_no' => 0,
              'group_no' => 0,
            ),
          ),
        ),
        'options' => array (
          'position' => 'normal',
          'layout' => 'no_box',
          'hide_on_screen' => array (
          ),
        ),
        'menu_order' => 0,
      ));
    }
    
    

    and here is the code in the template, which is just a copy of yours

    
    if( have_rows('downloads') ): ?>
      
      <div id="downloads">
        <?php
          // loop through rows (parent repeater)
          while( have_rows('downloads') ): the_row();
        ?>
        
        <div class="downloads-title">
          <h3><?php the_sub_field('downloads_title'); ?></h3>
          <i class="downloads-border"></i>
          
          <?php
            // check for rows (sub repeater)
            if( have_rows('documents') ):
          ?>
            
          <ul class="fa-ul">
            <?php
              // loop through rows (sub repeater)
              while( have_rows('documents') ): the_row();
            
              // display each item as a list - with a class of completed ( if completed )
              $file = get_sub_field('document_upload'); 
            ?>
            
            <li><i class="fa-li fa fa-download"></i><a href="<?php echo $file['url']; ?>"><?php the_sub_field('document_name'); ?></a></li>
            
            <?php endwhile; ?>
          </ul>
          
          <?php endif; //if( get_sub_field('documents') ): ?>
        </div>
        <?php endwhile; // while( have_rows('downloads') ): ?>
      </div>
    <?php endif;
    
  • Hi @tdmalone,
    I had this same exact issue a while back and found it was actually how the custom field keys were being saved in the database. Essentially, once you reach a certain character limit (length) inside the database for these keys, they stop saving. I brought this up to ACF support and was directed to purchase the ACF PRO version as they save these fields in a different fashion and with greater lengths. After upgrading to ACF pro, the issues stopped happening and now have very complex nested repeaters that work flawlessly. Also to note, you will not lose any custom fields or data you have created in the regular version as ACF PRO imports all of the old info. Hope this helps.

  • Yes, ACF is doing possibly two queries for every field that needs to be updated. The reason that it does it that it uses the WP function update_metadata for each field.

    I have run into this myself in the past and I now think about how much data will need to be saved before I make a decision on how to build it. With a long list like that I would now probably create a custom post type for storing that information. To be honest, I don’t know why there is such a difference between update_field() and saving through the admin.

    As far as not updating… yes the page times out, but depending on the server time limit, for example if you add set_time_limit(0) the code will continue to run till completion because PHP only checks to see if the user has disconnected when it tries to send output and it will not try to send output until the process is complete.

    I could not go back and rebuild the site that had a problem but what I could to is add an acf/save_post filter that runs before ACF starts, check to see if it was the post type that was giving me problems and if it was I set the time limit to 0. Now when it times out if you hit the browser back button instead of the reload button, then wait a minute and reload the page with the group on it, it will show all of the changes. A PITA I hope to avoid myself in the future.

    Anyway, I know it’s not a solution, and I can’t say what the solutions is, but I will mark this topic for the developer to take a look at and maybe he’ll be able to find a way to solve it in the future.

  • I wouldn’t worry about the post id and the revisions most of the time, although I generally tend to turn of auto saving and install a plugin to limit the number of revisions that are saved just to keep the db size down.

  • If you can do it with a cron task then you don’t need to worry about it timing out. You can set_time_limit(0);

    Like I said, there are some known issues with doing queries and joins or multiple inner joins from the post to the postmeta table. I’ve recently read about it but don’t recall where. There are plans to fix it, but that doesn’t solve you problem now. But what this means is that if it’s queries for searching posts by post meta, depending on how many meta_query values you’re supplying it may not help the problem.

    Also, it won’t stop the empty rows from building up in the database in the future. If this is a concern then you should create an acf/save_post action to remove empty fields when posts are published or updated in the future. http://www.advancedcustomfields.com/resources/acfsave_post/

    I’d really like to know if removing the empty values helps your situation, it it does I’ll likely build a plugin for myself that does this on all ACF fields.

  • Hi @skasprick

    Hm okay. I think you might have two different issues here:

    1. Sometimes when changing the return value you need to resave the post/term/whatever for the changes to occur. If you initially had term object you might want to try resaving.
    2. I’m fairly certain that when using the checkbox layout the return wont just be an ID integer but an array. Try this:

    
    <?php
    $part_category = get_sub_field('part_category'); // This HAS to be a string value. Make sure that it's not an array or term object.
    $args = array(
    	'post_type' => 'sweeps',
    	'posts_per_page' => -1, //fetches ALL posts without limit
    	'order' => 'ASC',
    	'orderby' => 'meta_value',
    	'meta_key' => 'weight_lbs',
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'category', // If you're using a custom taxonomy this needs to be changed
    			'terms' => array($part_category[0]),
    			'field' => 'term_id'	
    		)
    		
    	)
    );
    $catquery = new WP_Query($args); 
    ?>
    

    Or possibly:

    
    <?php
    $part_category = get_sub_field('part_category'); // This HAS to be a string value. Make sure that it's not an array or term object.
    $args = array(
    	'post_type' => 'sweeps',
    	'posts_per_page' => -1, //fetches ALL posts without limit
    	'order' => 'ASC',
    	'orderby' => 'meta_value',
    	'meta_key' => 'weight_lbs',
    	'tax_query' => array(
    		array(
    			'taxonomy' => 'category', // If you're using a custom taxonomy this needs to be changed
    			'terms' => array($part_category[0]->term_id),
    			'field' => 'term_id'	
    		)
    		
    	)
    );
    $catquery = new WP_Query($args); 
    ?>
    
  • I’m having exactly the same issue.
    Currently developing a website in WP 4.3 using ACF 5.3.0.

    When having site options with a nested repeater, only some of the field values are saved when clicking on save.

    After having done some tests, i looks like the cause of this is a limitation of character for the field-name inside the nested repeaters.

    for my case:
    timeline_title (14chars did not save)
    timelinetitle (13chars saved)

    test:
    abcdefghijklm (13chars saved)
    abcdefghijklmo (14chars did not save)

    so a workaround until this gets fixed is to use a maximum of 13 characters for field-names.

    cheers,

    Tom

Viewing 25 results - 51 through 75 (of 148 total)