Skip Navigation

[Waiting for user confirmation] Sorting repeatable fields

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 1 reply, has 1 voice.

Last updated by Minesh 6 days, 3 hours ago.

Assisted by: Minesh.

Author
Posts
#2791194
Print screen post editor.png
Print screen custom field editor.png

Tell us what you are trying to do?

I defined for a custom post a custom field 'Notes', which is used in the post editor window (backend) for note taking by authors, which contribute to a post. Notes contain remarks during the work flow. This custom field 'notes' is defined as repeatable field or field with multiple instances. In this way, each author can add a new note during the work flow. Everything is ok, BUT: default sorting of the notes is defined as 'newest note is the lowest note, oldest note is the first one'.

We would like to have the opposite order, that means 'newest note is the first one in the column, oldest note is the last in the column' (see screen shot of the post edit window, notes are located in the right sidebar). I found this Toolset article

https://toolset.com/errata/toolset-forms-not-saving-sort-order-for-repeating-fields-and-repeatable-fields-groups/

in which is the remark:
Those two features have (in the Repeating Field case hidden) custom fields that determine the “Sort Order” in which they appear in the post (and other places, like Views, for example).

but I cannot find any menu to define sorting (see print screen of custom field definition).

How can I influence the sorting of the notes?

Is there any documentation that you are following?
s. above

Is there a similar example that we can see?
no

What is the link to your site?

#2791260

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand - you want to change the default sort order of repeating field in the backend admin. If this is true:

There is no such feature available - maybe you can use the "save_post" hook and customize the sort order as required.

The sort order of "Repeating Fields" saved in database with the slug:

_wpcf-{field-slug}-sort-order

and field value is in serialized array format.

In your cause it will be: _wpcf-notiz-inhalt-sort-order

More info:
- https://toolset.com/documentation/customizing-sites-using-php/updating-types-fields-using-php/

Pleaes check the following related ticket that might help you:
- https://toolset.com/forums/topic/updating-sort-order-for-fields-with-multiple-values/#post-1651205