Removing quiz questions answers from all comments in backend

Please add the given code in wplms-customizer.php file in wplms customizer plugin :

add_action( 'pre_get_comments', 'wplms_remove_comments_admin_panel' );
function wplms_remove_comments_admin_panel( $query ){
      if( $page->base =='edit-comments')
      $query->query_vars['post_type'] = array('post','unit','course','wplms-assignment','product');
  return $query;

Note : if you have any other custom post types then please add that post type in the array in the code like this :

change this line to add new custom post type :

$query->query_vars['post_type'] = array('post','unit','course','wplms-assignment','product','pages');

In above line I added “pages” .

Was this article helpful?


  1. I try to add this code and keep getting a Fatal error:

    Cannot redeclare search_field_comments() (previously declared in /nas/content/staging/a4da/wp-content/plugins/wplms-customizer/wplms-customizer.php:61) in /nas/content/staging/a4da/wp-content/plugins/wplms-customizer/wplms-customizer.php on line 75

  2. karolla86


    add product to code.

  3. Alex

    I updated the tip .Please remove the previous code and try adding the above code again .

  4. coaching-quebec

    I did that two months ago and it worked well. But since a moment (I noticed last week), the quiz answers have come back in the comments in the backend. I went to see in wplms-customizer.php to see if the code was still there, and it is. I updated the theme a month ago. Is it due to the theme update?

  5. daammon

    I did this and in “Activity/Recenctly Published” in the WordPress Dashboard I am still getting all the messages of the quiz questions.
    Additionally, when a student submitts an assigment, I got them as a message too. I am not sure if that is related or not. If not, I will make a separate topic.

  6. WP Admin – Plugins – Editor – Select WPLMS customizer.
    Any changes in customizer can also be added to wplms child theme.

Leave A Comment?