Home Forums ACF PRO Order by relationship post title Reply To: Order by relationship post title

  • Hi @cecilehabran

    Thank you for the question.

    You can achieve this by hooking into the acf/fields/relationship/query filter. You can modify the $args array as follows:

    function my_relationship_query( $args, $field, $post )
        // increase the posts per page
        $args['posts_per_page'] = 25;
        $args['orderby'] = 'title';
        return $args;
    // filter for a specific field based on it's name
    add_filter('acf/fields/relationship/query/name=my_select', 'my_relationship_query', 10, 3);

    You can have a look at the following resource page