wp query – How to display custom comment type in wp-admin Comments section?
Question
I have a project with custom theme that has several custom comment types for different parts of the site and we want as administrators to moderate it.
I tried using the parse_comment_query
and comments_pre_query
filters but it didn’t work.
here is my code:
add_action('parse_comment_query', function ($query) {
if( is_admin() ) {
$query->query_vars['type__in']=['review', 'comment'];
}
}, PHP_INT_MAX, 1);
add_filter('comments_pre_query', function ($comment_data, $query) {
if( is_admin() ) {
$query->query_vars['type__in']=['review', 'comment'];
}
return $comment_data;
}, PHP_INT_MAX, 2);
For now, I only see the comment type comment
, but I’m looking for other types as well, such as review
, vote
, etc.
0
2 weeks
2023-05-20T02:34:02-05:00
2023-05-20T02:34:02-05:00 0 Answers
0 views
0
Leave an answer