Order comments in admin by custom date


I need to order the comments in the admin by a custom date field; named ‘datum_van_uitvoering’.

At the front-end i did the trick with get_comments. But now i have to order the backend ass well and for what i know i have to do it with pre_get_comments.

So far, i have

function display_comments_ordered_by_metadate($query){
global $pagenow;
if($query->is_admin) {
    $query->query_vars['meta_query'] = [
            'order' => 'DESC',  
            'orderby' => 'meta_value_num',
            'meta_key' => 'datum_van_uitvoering',

But it’s not yet working… Any advice here?

, Davel 8 months 0 Answers 56 views 0

Leave an answer