Home Forums Front-end Issues Order Category By ACF


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)

You must be logged in to reply to this topic.