• Resolved gcgroup

    (@gcgroup)


    We’re using Category Order and Taxonomy Terms Order to sort groups of posts, and the order is saved so clearly the ajax script works. However, when we installed about a year ago we had a function to save the order to the database menu_order column. That stopped working. Do you have a suggestion for a function that will work to post the menu_order values?

    Here’s my old function that stopped working:

    add_action ( ‘wp_ajax_save_menu_order’, ‘menu_order_save’ );
    function menu_order_save () {
    global $wpdb;
    $wpdb->flush ();
    $item_id = $_POST[‘post_id’];
    $meta_key = ‘_menu_order’;

    $int = preg_replace(“/[^0-9]/”, “”, $_POST[‘order’]);

    update_post_meta ( $item_id, $meta_key, array ( ‘menu_order’ => $int ) );

    $response = ‘

    Post order updated’;
    echo $response;

    die(0);
    }

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Maya

    (@tdgu)

    Hi,
    Sorry but apparently you make some confusions:
    1) There is no menu_order for the terms, there is a term_order instead.
    2) The menu_order is a post object property. Maybe you meant to use the code with a different plugin?
    3) There is no such filter as wp_ajax_save_menu_order available with our code. Also within your code, there is the $_POST[‘post_id’] which clearly means is not related to a term object but a post instead.

    Thanks

    Thread Starter gcgroup

    (@gcgroup)

    Oops! You’re right. That is another plugin. Thanks very much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘action to update menu_order to database’ is closed to new replies.