Support » Plugin: Simple Page Ordering » Page Ordering Not saving correctly in WordPress 4.0?

  • Resolved brendanonerabbit

    (@brendanonerabbit)



    Hi,
    When using this plugin in WordPress 4.0 it appears that the drag-and-drop page ordering isn’t saving some of them time.
    If I come page to the page list later the order does not stay in the same order as when I dragged and dropped.
    It also appears to display the order in descending order instead of ascending now. After updating WordPress the “Sort By Order” option is showing the pages in the reverse order that had been saved.

    Anyone else experiencing this behaviour?

    https://wordpress.org/plugins/simple-page-ordering/

Viewing 10 replies - 1 through 10 (of 10 total)
  • +1. Have the same issue.

    I’ve the same issue. I’ve disabled the plugin , but I still get the reverse order.

    This is the thing: http://make.wordpress.org/core/2014/08/29/a-more-powerful-order-by-in-wordpress-4-0/

    If you are using this plugin to order your custom posts/ pages, this order is saved in the database so whatever you disable the plugin or not, the order remains.

    If before 4.0 you had an order it was because the query arguments was like so:

    'order' => 'menu_item date', // this means the page/ custom post is ordered by a custom number and if that custom number is equal it will order by date.
    'orderby' => "DESC", // descending order

    The descending order was applied only to the date attribute and the order of the menu_item(which is handled by this plugin) was still ASCENDING [bug].

    Now on 4.0 this bug was fixed and the orderby argument is applied to both.

    Whatever, the fix should be a query argument like so:

    'orderby' => array('menu_order' => 'ASC', 'date' => 'DESC'),

    Have fun!

    83,85c83
    < 		if (is_string(get_query_var('orderby')) && 0 === strpos( get_query_var('orderby'), 'menu_order' )
    < 			|| is_array(get_query_var('orderby')) && key_exists('menu_order', get_query_var('orderby'))
    < 			) {
    ---
    > 		if ( 0 === strpos( get_query_var('orderby'), 'menu_order' ) ) {
    167c165,166
    < 			'orderby' 					=> array('menu_order'=>'ASC','title'=>'ASC'),
    ---
    > 			'orderby' 					=> 'menu_order title',
    > 			'order' 					=> 'ASC',
    279c278
    < 		$query_string = add_query_arg('orderby',array('menu_order'=>'ASC', 'title'=>'ASC'),$query_string);
    ---
    > 		$query_string = add_query_arg( 'orderby', urlencode('menu_order title'), $query_string );

    Created a simple patch to solve this issue

    *edit*
    https://gist.github.com/anonymous/53dede391e80fb5b39ea

    Thanks a lot for sharing the patch. Hope there will be a new release of the plugin.

    Thank you for the patch, ByronicEntity! It works well.

    Plugin Author Jake Goldman

    (@jakemgold)

    10up Engineer

    Fixed in 2.2.3 – sorry for the delay on this. The WP Query change in 4.0 came late in the cycle. Thanks for the tip off euthelup.

    (Note that ByronicEntity’s fix isn’t quite right – should still upgrade.)

    Hi Jake,

    I’m still experiencing this issue with 2.2.3 and WP 4.0.

    I drag posts (cpt) in my preferred order. When I then reload this admin page the post order returns back to the previous state…

    Bart

    vinaganda

    (@vinaganda)

    2.2.3 and WP 4.0.
    Same problem as Bart when I then reload the admin the post order returns back to the previous state.

    I am also experiencing this bug, the order is not saved.

    Using version 2.2.3 and WP 4.1

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Page Ordering Not saving correctly in WordPress 4.0?’ is closed to new replies.