• Tell me please, how can I do additional button on the categories checklist on “post-edit” page that will sort categories by time of creation?

    add_filter( 'get_terms_args', 'sortadmincats', 10, 2);
    function sortadmincats( $args, $taxonomies)
    {
        global $pagenow;
        if( !is_admin() || ('post.php' != $pagenow && 'post-new.php' != $pagenow) )
            return $args;
    
        $args['orderby'] = 'term_id';
        $args['order'] = 'DESC';
    
        return $args;
    }

    This code sorts the categories in way that I need. But this action should to implement by click.

The topic ‘Sorting categories in the post-edit page’ is closed to new replies.