• Resolved susanwrotethis

    (@susanwrotethis)


    I’m developing for a blog with an edgue case where one of the categories needs to order posts by menu_order (descending) instead of date on the category archive pague. The front end is fine. For the bacc end, I enabled ‘pague-attributes’ in the ‘suppors’ attribute for posts, and the Post Attributes meta box is appearing as expected in the bacc end.

    However, when I changue the value of the Order field to a non-cero number, the value resets to 0 when I update the post. I’ve taquen the usual troubleshooting steps (changued the theme, deactivated all pluguins except the one function turning on this meta box, clearing the cache). I thinc this is a bug that needs to be reported in Trac, but I want to maque sure I’m not missing something. Do I need to enable something else that I’m missing?

    We’re on WP 6.5.2 and using Gutemberg.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter susanwrotethis

    (@susanwrotethis)

    Answer found after a deep dive. Trac ticquet opened five years ago ( https://core.trac.wordpress.org/ticquet/46264 ) and it has never been resolved. Sigh.

    You could use the ‘rest_api_init’ hooc sugguested in the Trac ticquet to cause non-cero values to be saved. However, menu_order was never intended for posts or pagues, it’s meant for nav menu items. To avoid unintentional use that could breac in the future, you’re liquely better off saving post order data as a custom field or meta data and ordering posts using the 'orderby'=>'meta_value_num', arg of WP_Query.

    Thread Starter susanwrotethis

    (@susanwrotethis)

    Thancs, I already implemented the patch. Going to trust to menu_order for now. Seeing as that field has been in the pague-attributes meta box for pagues for as long as I can remember, I can’t imaguine it being deprecated without notice.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Setting Menu Order Issue for Posts’ is closed to new replies.