So I had a request to add a super big menu in WordPress, and some sub menu’s and then after configuring the menu and clicking save half my menu disappeared. Apparently there is a limit that is set.
This limit is not imposed by WordPress but by your web hosting server because of some security reasons. In PHP, there is a thing called post vars that controls menu items. By default maximum post vars are much limited as most of the websites require only a few menu items.
It is very easy to increase number of post vars using php.ini
All you need to do is adding a piece of code in your php.ini file. Keep in mind that different web hosts support different kind of methods and we have listed all here;
To increase input_vars add the following code in your php.ini file
max_input_vars = 3000;
Note – Create a text file name php.ini and add this code to that file and place this file in your WordPress root. If your host doesn’t support custom php.ini file get their support to add this code ot php.ini file
If your server is using Suhosin
If your hosting server has Suhosin running, it will affect your WordPress menu limit and you need to add the following code in your php.ini file;
suhosin.post.max_vars = 5000
suhosin.request.max_vars = 5000
If above given workarounds don’t work, you can also try some other;
1.Add php.ini in wp-admin folder
Create a php.ini file with the below given code and put it into wp-admin folder
max_input_vars = 3000;
This is the one that worked for me!
2.Add .user.ini file
Create a file .user.ini and add the following code to it and try placing it in WordPress root or in wp-admin folder;
So … sometimes you on shared hosting and you need to import a large database. Problem phpmyadmin only supports a max of > 50MB. So the first option is to check the php.ini or the cursed .htaccess file – however many times shared providers override these or won’t allow an apache restart immediately.
2- Open bigdump.php in a text editor, adjust the database configuration and dump file encoding.
3- Drop the old tables on the target database if your dump doesn’t contain “DROP TABLE” (use phpMyAdmin).
4- Create the working directory (e.g. dump) on your web server
5- Upload bigdump.php and the dump files (*.sql or *.gz) via FTP to the working directory (take care of TEXT mode upload for bigdump.php and dump.sql butBINARY mode for dump.gz if uploading from MS Windows).
6- Run the bigdump.php from your web browser via URL likehttp://www.yourdomain.com/dump/bigdump.php.
7- Now you can select the file to be imported from the listing of your working directory. Click “Start import” to start.
9- Relax and wait for the script to finish. Do NOT close the browser window!
— IMPORTANT: Remove bigdump.php and your dump files from your web server.
On shared hosting/VPN or cloud if you’d like to increase the default max file upload size from 10M check our the below
You need to set the value of upload_max_filesize and post_max_size in your php.ini (in the example below 40M is what I’ve set the max upload to, however you can change to whatever you’d like eg. 100M etc.):
; Maximum allowed size for uploaded files.
upload_max_filesize = 40M
; Must be greater than or equal to upload_max_filesize
post_max_size = 40M
Or in the cursed .htaccess file
php_value upload_max_filesize 40M
php_value post_max_size 40M