Ask your WordPress questions! Pay money and get answers fast! (more info)

Separate backend menu item for woocommerce product reviews WordPress

  • SOLVED

How do I filter woocommerce reviews so that they show up as a separate menu item in the backend, instead of being within the comments menu item?

Thanks

Answers (3)

2013-08-06

Hariprasad Vijayan answers:

Hi,

You want to remove/hide the woocommerce product review from wordpress comment list and need to display product reviews separate. Right?


Hariprasad Vijayan comments:

The following code will remove all reviews from wordpress comments

function separate_comments_and_review( $clauses, $wp_comment_query )
{
global $wpdb;
if ( ! $clauses['join'] )
$clauses['join'] = "JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->comments.comment_post_ID";
if ( ! $wp_comment_query->query_vars['post_type' ] ) // only apply if post_type hasn't already been queried
$clauses['where'] .= $wpdb->prepare( " AND {$wpdb->posts}.post_type != %s", 'product' );
return $clauses;
}
function check_current_page( $screen )
{
if ( $screen->id == 'edit-comments' ) // Checking comment page
{
add_filter( 'comments_clauses', 'separate_comments_and_review', 10, 2 );
}
}
add_action( 'current_screen', 'check_current_page', 10, 2 );


Can you please tell me where you want to display woocommerce review?


Hariprasad Vijayan comments:

Add the above code in function.php of your theme.


Hariprasad Vijayan comments:

Try the following method to add a submenu for product review under products menu

add_action('admin_menu', 'add_product_reviews');
function add_product_reviews() {
$post_type = 'product';
add_submenu_page("edit.php?post_type={$post_type}",__('Product Review'),__('Product Review'),'moderate_comments',"edit-comments.php?post_type={$post_type}" );
}

Add the code in function.php

Please ask if you need any help in this.


willcm comments:

Hi,

Thanks for this Hariprasad.

So I want it to appear below the products menu on the backend like so: