The Symptoms

You’re trying to save a page in WordPress that contains a large number of ACF fields, perhaps you have a custom page builder and it uses a repeater field so that users can add as many or as few elements as they need. However, when you save 1 or more of the ACF fields is not saving the information that’s been entered.

The Cause

This may strike you as odd as ACF is a very popular and reliable plugin (I’m not sponsored to say that) so it seems odd that it would contain a bug. However, the issue is not with ACF it’s with your PHP config and the way WordPress saves information. Generally, when you’re writing PHP and you’re dealing with a web form submission you use $_GET or $_POST to fetch the data from each field that was submitted. The $_GET and $_POST variables are associative arrays and each item inside those arrays is referred to as an input var.

PHP has a built-in limit on how many input vars you can submit at any one time to prevent overload the system. Unfortunately since each ACF field is a separate input var if you have a page with a large number of ACF inputs you might hit this limit and the additional data gets dropped making it look as if the field has not saved.

The Solution

To fix this you essentially just need to increase the max_input_vars value. You can do this in several different places:

php.ini

max_input_vars=1000

.htaccess

php_value max_input_vars 1000

wp-config.php

@ini_set('max_input_vars', 1000);

One other possible alternative is that you might be hitting the max upload or max post size limits, you can increase these in similar ways:

php.ini

upload_max_filesize = 20M
post_max_size = 20M

.htaccess

php_value upload_max_filesize 20M
php_value post_max_size 20M

wp-config.php

@ini_set('upload_max_filesize', '20M');
@ini_set('post_max_size', '20M');


0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.