WP terms doesn't sort

  • Unknown's avatar

    Hello,

    I am trying to get sorted terms filtered by custom term meta.

        $parent_term_id = 60;
        $cat_args = array(
            'parent' => $parent_term_id,
            'orderby' => 'DATE',
            'order' => 'ASC',
            'meta_key' => 'created',
            'meta_type' => 'DATE'
        );
        $terms =  get_terms('product_cat', $cat_args);

    I got these terms filtered and it returns only with ‘created’ meta value. However, if I print term meta values (‘created’), I got

    [“2021-12-20”][“2021-11-03”][“2022-05-03”][“2022-02-18”][“2021-11-26”][“2020-10-27”]

    Which is not ordered by date. What is wrong in my query?

    The blog I need help with is: (visible only to logged in users)

  • Hi there,

    The best place to get help with that are the WordPress.org support forums:

    https://wordpress.org/support/forums/

    The forum you have posted is for the WordPress.com hosting platform, which is different than the WordPress software that your site is using. You can learn more about these differences here:

    WordPress.com vs. WordPress.org

  • The topic ‘WP terms doesn't sort’ is closed to new replies.