Thread Starter
wp_kc
(@wp_kc)
Some additional details…
Server setup:
- Debian 9
- WordPress – Version 4.9.8
- PHP 7.0 FPM
- Advanced Custom Fields – Version 4.4.12
- Advanced Custom Fields: Flexible Content Field – Version 2.1.0 (w/valid license)
- Advanced Custom Fields: Repeater Field – Version 2.1.0 (w/valid license)
Conditions causing the bug:
- The problem occurs when trying to add a new location rule to a field group using a single flexible content field.
- The flexible content field had 12 layouts, with a total of 37 sub-fields among them.
- The field group had 6 Location rules.
- 8 ‘Hide on Screen’ items were checkmarked
- This setup had been working in the past on the same server, with the same configurations files.
- Trying to add a new location rule resulted in the last 3 layouts (along with their 7 sub-fields) being deleted. The new rule also was not saved. And the last field of the last surviving layout was deleted, as well as some settings of the second to last sub-field.
Temporary work-around:
I bumped the php.ini variable ‘max_input_vars’ up to 2000, restarted apache, reconstructed the field group and was able to save it. So too many form variables being submitted at once is definitely causing the problem. Luckily, everything that used that field group was restored to normal operation after reconstructing the field group. Then I returned ‘max_input_vars’ to its default value of 1000 and restarted apache again to prevent attackers from trying to abuse GET and POST requests.
Suggested solution:
It is my understanding that WordPress is moving toward using its REST-API for all screens in the admin area. Maybe now is a good time to start converting ACF to submit all data from the field group editor as a single JSON data string. This would avoid triggering the default 1000 input variable setting on apache.