ColorlibHQ / simple-custom-post-order

Order posts(posts, any custom post types) using a Drag and Drop Sortable JavaScript. Configuration is unnecessary.
http://wordpress.org/plugins/simple-custom-post-order/
GNU General Public License v3.0
31 stars 20 forks source link

incompatibility with WPEngine #132

Open beatricelucaci opened 7 months ago

beatricelucaci commented 7 months ago

I also faced with issue, when order not saving, see my video please

https://disk.yandex.ru/i/EvB3U3YEuzorZg

This problem only on WPEngine hosting, on my local env everything OK

https://wordpress.org/support/topic/order-not-saving-2/

https://wordpress.org/support/topic/order-not-saving/

michaelearley1 commented 7 months ago

Same issue here. Reordering doesn't save

michaelearley1 commented 7 months ago

...also on WPEngine. When might we be able to expect a fix for this?

Buildbetter commented 7 months ago

please fix the bug

stevygee commented 5 months ago

+1 also on WP Engine

crashanywhere commented 5 months ago

I just finished with WPEngine support. I have this problem on my site running PHP 8.2. WPEngine support did not see any errors, and they could not find any evidence of the issue. We switched to PHP 7.4, and the custom sort order worked. So, the problem seems to be PHP 8.2, I suppose. Can you please provide an update on the status of this issue?

wilmingtondesignco commented 2 months ago

We are also seeing this ordering issue with sites running PHP 8.2 on WP Engine.

crashanywhere commented 2 months ago

I think I stumbled on a workaround for this. I am still testing to make sure it’s persistent. Again, I consider this a workaround, not a fix!

Here’s what I have been doing on WPEngine running PHP 8.2…

I reorder posts. I then choose ‘Add New Post’ from the admin sidebar. I cancel the new post. I then see that the reordered posts stay in the order I want.

I would be very grateful to anyone who tests this and finds it to work or not work!

+1 for finding a fix for this. We have 3 servers on WP Engine with hundreds of sites, many of which use Simple Custom Post Order.

We are also seeing this ordering issue with sites running PHP 8.2 on WP Engine.

wilmingtondesignco commented 2 months ago

@crashanywhere We were just playing around with things also

It appears it's related to Object Caching in WP Engine, which would match what you're seeing since "Add New Post" typically clears the cache automatically.

Try going to "WP Engine" in the upper left in the Admin and clearing cache before you make the ordering updates. That typically clears the cache and it usually takes ~5mins for it to be rebuilt

That should accomplish the similar effect as "Add New Post" in that it's just a matter of clearing the Object Cache (which stores the DB queries)

This appears to be more an issue of WP Engine Object Caching and order of operations, than an issue with the plugin code.

WP Engine can add "Cache Exclusions", I wonder if adding a caching exclusion for "/wp-admin/edit.php?post_type=page" would resolve this issue if you were ordering pages?

We have a custom post type for "Inventory" so we could add a caching exclusion for "/wp-admin/edit.php?post_type=inventory" which would in theory prevent that page content from caching?

We'll play with this more in the next few days and I'll let you know what we find out.

crashanywhere commented 2 months ago

OK, you are way ahead of me on knowing what’s going on! Keep me posted on anything you find out. Have you talked to WPEngine about this issue?

wilmingtondesignco commented 1 month ago

@crashanywhere So, this problem does appear to be a WP Engine caching issue.

I had WP Engine add a caching exclusion for the Admin URL that had the drag/drop ordering on it that I was having problems with.

I had them add this URL as the exclusion: /wp-admin/edit.php?post_type=inventory

Just hit up WP Engine via the Live Chat feature in your dashboard and type "support" to get a human, and ask them to add a caching exclusion for the Admin URL of the page where your drag/drop ordering is giving you problems.

Once the caching exclusion was added, I was able to drag/drop the entries and it worked as expected.

I did have to clear the cache again once I was finished with my drag/drop ordering, so just make sure to go to WP Engine->Caching->Clear all caches in the upper left in the Admin once you've finished re-ordering your entries. This clears the cache again, then refresh the front-end page and you should see your drag/drop ordering applied.

Just to clarify for the Plugin authors - This does NOT appear to be an issue with the Simple Custom Post Order plugin, it's related to WP Engine's aggressive Object Caching for database queries. (which is great for high-performance, quick-loading pages, but bad for AJAX queries that manipulate data in the Admin)

Screenshot of the caching exclusion applied in the WP Engine dashboard for context: wp-engine-cache-exclusion

wilmingtondesignco commented 1 month ago

Also, just to clarify, after adding the Cache Exclusion and setting the Drag/Drop ordering, the 'menu_order' field in the database is now sequentially numbered starting at 1 (instead of 0).

Before, when we were having issues, the menu_order values were all over the place and we'd have multiple duplicated numbers.

0 number indexes seemed to be especially problematic in trying to set the first record to display, and the index order appears to start at 1 now.

Screenshot 2024-09-09 at 2 59 56 PM

10000things commented 1 month ago

@wilmingtondesignco Thanks, I have the same issue at Siteground. Disabling their Memcached object caching in the SG Optimizer plugin seems to work. I hadn't noticed the problem before PHP 8.2x update, so it seems to be the combination. I also tried URL exclusion using /wp-admin/* but it didn't work. It also works to do a manual cache purge immediately after reordering custom posts BTW. The SG Optimizer plugin does have a public function for manual cache purging, I bet there's something similar for WP Engine and others -- does anyone know if there's a hook for after the reorder event that could be leveraged for this?