Your custom fields are not being saved? Here’s how to fix it with a simple line of code.
Have you ever found that custom fields are not saving correctly?
It is probably because you are using too many custom fields in the same post and you are exceeding the limit set by the PHP max_input_vars
directive.
Luckily, you can easily modify the limit. Let’s see how:
Code to increase the max_input_vars
directive
Add the following snippet in the wp-config.php file (before the line /* That’s all, stop editing! Happy publishing. */):
To see this and another 965 code snippets of this website, login or subscribe here.
With this snippet you get it to increase the max_input_vars
directive to 10000, which should be enough. But you can change this value to the one that best fits your case.
Conclusions
If you are using quite a few custom fields and notice that some are not being saved correctly, increasing the max_input_vars
directive may be the solution to your problem.
Now you know how to do it.
Any questions? Let me know in the comments.
And if you want to give me any suggestion for future tutorials, leave it in the contact form. Advantages of being a subscriber. 😉