Support

Account

Home Forums Add-ons Repeater Field Order repeatable field by date in back-end Reply To: Order repeatable field by date in back-end

  • Hi Federico!

    I was on a holiday so late reply here.

    Can you be more specific, do you have example code?

    Anyway, the code I used in my functions.php was:

    /**
     * Hooks the WP cpt_post_types filter 
     *
     * @param array $post_types An array of post type names that the templates be used by
     * @return array The array of post type names that the templates be used by
     **/
    function my_cpt_post_types( $post_types ) {
        $post_types[] = 'beugel';
        $post_types[] = 'kingweg';
        $post_types[] = 'groep_8';
        return $post_types;
    }
    add_filter( 'cpt_post_types', 'my_cpt_post_types' );
    
    function my_taxonomy_query( $args, $field, $post_id ) {
        
        // modify args
        $args['orderby'] = 'count';
        $args['order'] = 'ASC';
        
        
        // return
        return $args;
        
    }
    
    add_filter('acf/fields/taxonomy/query', 'my_taxonomy_query', 10, 3);