• Skip to primary navigation
  • Skip to main content
OsomCode

OsomCode

Awesome code tutorials for WordPress and Genesis

  • Subscribe
  • My account
    • Edit profile
    • Favorites
    • Update credit card
  • Login

What to do when custom fields are not saved

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 839 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. 😉

PHP WordPress wp-config

To leave read and make questions about this code, you can login or register.

  • About OsomCode
  • FAQ
  • Contact

Legal Notice · Privacy Policy · Cookie Policy · Terms and conditions
Copyright © 2023

Lost your password?