Support » Plugin: Simple Custom Post Order » Order keeps refreshing on every page load

  • Resolved ampersand

    (@davidemorotti)


    Hi folks,

    I’m having problem setting posts order, while using your plug-in.
    It appears that every time I refresh a page in the admin dashboard, the “refresh” function in the plugin’s files gets fired.

    In that function, there is a query which gets executed on active post types, which set the “menu_order” property based on the total number of results given for a specific post type. This query should set the “menu_order” property, by calculating a rank, based on the order of the IDs given by the query, which are ordered by “menu_order”.

    However, the result I get is not correct. I do get results ordered based on the previous “menu_order” value, but the ranking is not reflecting the order of the SQL query. The “rank” value apparently gets calculated based on the order of the IDs, which is wrong and keep resetting the order I previously set using your plug-in.

    Is this a known error? I’m the only one experiencing this issue?

    I’m using MariaDB 10.6.7

    • This topic was modified 2 months, 2 weeks ago by ampersand.
    • This topic was modified 2 months, 2 weeks ago by ampersand.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ampersand

    (@davidemorotti)

    Maybe it would be better to re-write the query like this?

    
    SET @row_number = 0;
    UPDATE $wpdb->posts SET menu_order = (
    				      SELECT @row_number:=@row_number + 1
    				      FROM (SELECT 1) tmp
    				      ORDER BY menu_order ASC
    			             )
    WHERE post_type = '" . $object . "' AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
    ORDER BY menu_order ASC
    • This reply was modified 2 months, 2 weeks ago by ampersand.
    Plugin Support beatrice12

    (@beatrice12)

    Hello @davidemorotti,

    Thanks for reaching out to us!

    Unfortunately, we were not able to replicate this on our end. Can you please let us know more exactly what post types you are ordering? Also, do you think there is any plugin which you think it might interfere with Simple Custom Post Order? If yes, please tell us which one so we can test it.

    Warmly,
    Beatrice.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.