Support

Account

Home Forums Front-end Issues Order Category By ACF

Unread

Order Category By ACF

  • Hello.

    I am letting my users order posts and categories with a custom field. Posts are very easy like described here.

    Unfortunately this didn’t work for categories:

    
    $args = array(
          'type'                     => 'post',
          'child_of'                 => 0,
          'meta_key'                 => 'order_cat',
          'orderby'                  => 'meta_value_num',
          'order'                    => 'DESC',
          'hide_empty'               => 0,
          'hierarchical'             => 1,
          'taxonomy'                 => 'category',
          'pad_counts'               => false 
        );
        $categories = get_categories($args);
    

    That returns all categories in alphabetical order instead of the order of ‘order_cat’.

    Can you please help me 🙂

Viewing 1 post (of 1 total)

The topic ‘Order Category By ACF’ is closed to new replies.