• Resolved iamryanyu

    (@iamryanyu)


    I have created a custom field with the Field type of the “Relationship” and the input type with “List view (with reordering)”.

    Now I have added “menu_order” in the ORDERBY section but the reordering not working when I drag and drop.

    How does the reordering work?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @iamryanyu

    Reordering is only working within the relationship field.
    This affects the order output when using that relationship field.

    The “menu_order” option is a fully separate WordPress core metafield where you can order by number. This is unrelated to relationships.

    Cheers, Jory

    Thread Starter iamryanyu

    (@iamryanyu)

    Thanks Jory for your reply.

    So does it mean the Reordering from the relationship field isn’t working on the frontend? If so, I am wondering what would be the main usage of the reordering if it doesn’t sync with how it prints on the frontend?

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @iamryanyu

    It does, but it depends on how you are using the field.

    If you are querying for posts using WP_Query and then filter by relationship the ordering is independent of the relationship field order.
    However, if you are displaying a field from that Post then you can use our display methods and it will order the items according to your relationship order.

    These are two vastly different methods of working with relationships and will work different entirely.
    Basically, the order you set within a relationship field is only available for the object that relationship is made from. Anywhere outside the scope of that object will use a different way or ordering depending on how you set your query.

    Cheers, Jory

    Thread Starter iamryanyu

    (@iamryanyu)

    Thanks a lot for the further detailed explanation.

    I am using WPGraphQL and wondering if there would be any way I could get the data (CV in my case as you can see from the screenshots below) in the order set in the relationship order.

    https://capture.dropbox.com/3o0zLJntbSsf36Ti
    https://capture.dropbox.com/FVyKWgr3GXqo55Z9
    https://capture.dropbox.com/9IHMmNadmcSEJvXI

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @iamryanyu

    It is stored as a metavalue in the post, prefixed as _post_METAKEY. Inside it you’ll find a serialized array value. Alternatively you can take a look at the podsrel table, it also includes all relationships and an order column (weight).

    Cheers, Jory

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How reordering works?’ is closed to new replies.