WordPress directing to Posts page (edit.php) instead of saving post

Issue

I have got a clean build (WordPress 3.9.1 running Twenty Fourteen theme).

I’ve installed WooCommerce plugin and added one product.

The product is a variable product with 65 variations.

When I link all variations and save, there are no issues. But editing any information such as stock quantities or price etc and hitting Update will cause the problem below.

Once I click Update, I am redirected to edit.php (the Posts page) and the changes were not saved. There is no error and everything seems to be running just fine.

Upon removing variations one by one I realised that once there’s less than 50, the post updates perfectly.

I’ve tried increasing memory in PHP.ini, .htaccess, wp-config.php and nothing.

Any ideas at all as I’m absolutely lost on this one.

Many thanks in advance.

Michael

EDIT: In actual fact, you don’t have to even attempt to change the properties of the new product. Even just trying to change this as it is will cause this issue.

Solution

I think your problem is with your shared hosting setup. Some shared hosts will add a maximum MySQL query length as a security measure. What is happening is that your host sees a huge query (because of all the variations) and drops the query entirely. Since you are doing smaller queries to add and remove variations, the issue doesn’t show itself until you want to update the product as a whole.

The fix to this issue would be to contact your hosting provider and have them increase the MySQL query length to a much larger value. You may be able to adjust this yourself in the admin panel, it is usually marked as a security feature so I would start there. You could also try updating the MySQL config (usually located at /etc/mysql/my.cnf or /etc/my.cnf) file to:

[mysqld]
max_allowed_packet=32M

If you are not able to update the config then you will definitely have to contact your hosting provider.

Answered By – Matthew R.

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published