Support

Account

Home Forums ACF PRO How-to change order of related listing Reply To: How-to change order of related listing

  • Hi @supersonique

    Yes, that hook is used to modify the returned post on relationship field. I believe you can use something like this:

    function my_relationship_query( $args, $field, $post_id ) {
    
        // only show children of the current post being edited
        $args['orderby'] = 'date';
        $args['order'] = 'DESC'; //change this to ASC or DESC
    
        // return
        return $args;
        
    }
    
    // filter for every field
    add_filter('acf/fields/relationship/query/name=my_relationship', 'my_relationship_query', 10, 3);

    Hope this helps!