Sunday, January 1, 2023
HomeWordPress DevelopmentExhibiting Counts on Remark Listing with Customized Question

Exhibiting Counts on Remark Listing with Customized Question


I’ve added a meta worth to the comments-meta desk that provides a {custom} ‘standing’ kind code (known as ‘redacted’) to a remark. I’ve used the next code to show a hyperlink to show solely these feedback with a particular meta worth on the edit-comments.php admin Feedback web page. This was completed with the next code:

// add to the remark hyperlinks on the high of the feedback record admin web page
    perform my_comment_link_add($status_links) {
        $status_links['redacted']= "<a href="https://wordpress.stackexchange.com/questions/412509/?standing=redacted">Redacted</a>";
        return $status_links;
        }
    add_filter("comment_status_links","my_comment_link_add");

// if clicked on the hyperlink, modify the remark question
if (isset($_GET['status']) AND ($_GET['status'] == 'Redacted')) {
    add_action('pre_get_comments', 'my_comment_redacted_list' );
}
perform my_comment_redacted_list($question)
{
    international $pagenow;
   // if ( is_admin() && ('your-custom-page' === $pagenow) ) {
        $query->query_vars['meta_query'] = [
                    'relation' => 'AND',
            [
                'key' => 'redact',
                'value' => '1'
            ],
        ];
     
        return;     }

Clicking on the brand new ‘Redacted’ hyperlink shows the feedback which have the ‘redact’ key within the comment_meta desk.

However:

  1. the ‘Redacted’ hyperlink doesn’t present the rely of the {custom} question data discovered (when All feedback are proven within the desk).
  2. If I click on on the ‘Redacted’ hyperlink, solely the ‘redacted’ feedback are proven on the record. However the ‘All’ hyperlink solely exhibits the rely of the {custom} question (the rely of ‘redacted’ feedback), not the entire variety of feedback. (In truth, all the counters on the hyperlinks line solely present the results of the {custom} question.)

Is there a extra environment friendly approach of doing this? How do I present the right rely for the ‘Redacted’ hyperlink on the ‘all feedback’ desk record. And the way do I present the right ‘All’ rely when solely the ‘Redacted’ feedback are proven on the desk record.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments