Show newest chapters on top in ACF relationship

This commit is contained in:
Tetrakern 2023-06-02 20:07:46 +02:00
parent 5107c7fc0d
commit 0cab2324f6

View File

@ -81,12 +81,19 @@ if ( ! class_exists('acf') && is_admin() ) {
*/
function fictioneer_acf_filter_chapters( $args, $field, $post_id ) {
$args[ 'meta_query' ] = array(
// Limit to chapters set to this story
$args['meta_query'] = array(
array(
'key' => 'fictioneer_chapter_story',
'value' => $post_id
)
);
// Order by date, descending, to see the newest on top
$args['orderby'] = 'date';
$args['order'] = 'desc';
// Return
return $args;
}