Can't save wordpress menu - help!

Need urgent help on this! I have a wordpress menu that has some (around 100) menu items and most of them are custom links.

I can't seem to succesfully save the menu on edit. When I hit the update button after making the necessary changes, nginx throws a "bad gateway" error, after about 5 mins of waiting.

Now, our server is a VPS and I don't think it's getting bogged down by the update. Have googled this and found out there is a custom link limit on wordpress menus, applied the patch discussed here to php.ini:

http://www.wpbeginner.com/wp-tutorials/how-to-fix-the-custom-menu-items-limit-in-wordpress/

Did not seem to remedy the situation. I need your help on this one, and it's rather urgent. Thanks a lot for your support!

  • Nithin

    Hi Alp,

    Hope you are doing good today. :slight_smile:

    If the issue is related to custom menu item link limit, then I'm afraid it entirely depends upon your server limit, what's the current current value you have set for suhosin limitation?

    Could you also enable debug mode, so that we could check whether there are any other errors related to this issue? To enable it, open your wp-config.php file located in your root directory, and look for define(‘WP_DEBUG’, false);. Change it to:

    define('WP_DEBUG', true);

    In order to enable the error logging to a file on the server you need to add:

    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );

    After making the above changes, please try to the replicate the issue. The related errors will be saved to a debug.log log file inside the /wp-content/ directory.

    Please attach these in your next reply in txt format file, so that we could give a closer look. You can find more details about debugging here.

    Please let us know how that goes, have a nice weekend.

    Kind Regards,
    Nithin

  • Ash

    Ohh one more thing:

    So I edited php.ini under /etc/php/5.6/fpm if I remember correctly. Is that the correct folder?

    We can't say it for sure. If you have multiple php installed then it may vary. It may also vary if you installed any third party combined package like cPanel or Sentora. So it's better to ask your hosting provider who set it up, he can make sure about that :slight_smile:

    Have a good day!

    Cheers
    Ash

  • Alp

    Hi Nithin / Ash,

    Thanks all for your efforts, here is the debug log txt file, though there is not much on there related to this error, maybe you guys can find something out of this.

    Ash: I set the server up with Easyengine, so there is no one to ask where the php.ini file is actually :slight_smile:
    I searched for "php.ini" in the system, turns out only two files, one under /etc/php/5.6/fpm/php.ini
    and /etc/php/5.6/cli/php.ini, that's all. Added the required modifications to both of them, but still no luck.

    I'm going to try to increase the PHP memory limit, I'll update you after I try that. If you have any other suggestions, they are most welcome. Thanks,

  • Rupok

    Hi Alp,

    I set the server up with Easyengine, so there is no one to ask where the php.ini file is actually

    I just searched for you and it seems like, in default configuration of EasyEngine. php.ini file is in "/etc/php5/fpm/" directory. You can check this official documentation for reference: https://easyengine.io/tutorials/php/increase-script-execution-time/

    I'm going to try to increase the PHP memory limit, I'll update you after I try that.

    You can also try increasing maximum execution time as shown in the above document. Please let us know how it goes. We will be glad to investigate further if nothing of these help.

    Have a nice day. Cheers!
    Rupok

  • Alp

    Hugo: I have solved it, but I have to admit the solution is a bit awkward, and I did not like it very much. Your comments / propositions are welcome on this.

    First, what I did;
    Added to php.ini (under /etc/php/5.6/fpm);

    memory_limit = 256M
    max_post_vars = 5000
    max_input_vars = 5000

    Changed in nginx.conf
    fastcgi_read_timeout 300;
    to
    fastcgi_read_timeout 600;

    Added to /etc/php/5.6/fpm/pool.d/www.conf
    request_terminate_timeout = 600

    Now this solves my current problem. However, I'm really not comfortable allocating 10 minutes of wait time for fastcgi requests. What do you think, really need some help here.

    Also, when I save the menu, the server cannot load any other page. For example, when I hit "update menu" button in admin and try to load the homepage in another browser window, the server is unable to load the page until the menu is saved (which takes around 3-4 minutes by the way). Why do you think this is happening? Thanks a lot,

    Alp

  • Rupok

    Hi Alp,

    the server is unable to load the page until the menu is saved (which takes around 3-4 minutes by the way)

    Well, you have set fastcgi_read_timeout to 600 seconds, that means 5 minutes. And you said your process takes 3-4 minutes. So it clearly says that this was the issue. Your read timeout should be more than what it needs to process.

    Regarding your second query "Why do you think this is happening?", this is very hard to answer. Actually it depends on your server configuration and how dynamic data is being processed. Because, in standard setup, WordPress doesn't take even a minute to save a menu with more than 100 items. I just added 100+ items in the menu of my test site and saved. It was saved and the page reloaded within 4 seconds. I tested with default Twenty Twelve theme.

    So most probably your server is causing this delay, I'm not sure though. Your theme, or other plugins also may cause this. Just to make sure no other plugin is causing this, can you please do a plugin conflict test? To know more about plugin conflict test, you can check this guide: http://premium.wpmudev.org/manuals/using-wpmu-dev/getting-support/

    Also to be sure that your current theme is not the issue, can you try activating any default WordPress theme and check if your current theme is responsible for this or not?

    And to know if your hosting configuration is the issue, can you try setting up a new temporary server instance and configure the server with Ubuntu default LAMP configuration? You can easily setup full LAMP environment with the following command:
    sudo apt-get install lamp-server^
    Then clone your site to that instance and check if processing time is same there.

    Please let us know your findings. We will be glad to assist further if required.

    Have a nice day. Cheers!
    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.