Hello to all dear friends,
How can we add a new row actions item to product reviews?
I used the following code, but the new item is not added
add_filter('comment_row_actions','my_action_row', 100, 2);
function my_action_row($actions, $comment){
$actions = '<a href="http://www.google.com/?q='.get_permalink($post->ID).'">check if indexed</a>';
return $actions;
}
I have included a picture for you
https://postimg.cc/v4K2SwDB
2
Answers
i use this code from my plguins Fatal error: Uncaught Error: Class "CustomReviewsListTable" not found
}, 10, 2 );
The comment_row_actions filter is intended for WordPress > Comments, not for Woocommerce > Product > Reviews.
As of the latest Woocommerce v9.0.2, the "Review action links" is being handled at woocommerce/src/Internal/Admin/ProductReviews/ReviewsListTable.php in which extended from a WordPress core WP_List_Table class.
The action links are being processed in Woocommerce ReviewsListTable class at handle_row_actions method. However, the plugin is currently not offering any hook that anyone can use to integrate a custom review link.
In this case, the only way to achieve the functionality is to recreate the Reviews List Table using the woocommerce_product_reviews_list_table filter hook. However, this will require overriding one of the Woocommerce core class.
Note: This approach is highly not recommended. This answer is only intended to share information on how to achieve such goal.
Recreate the Woocommerce Reviews List Table using the woocommerce_product_reviews_list_table filter hook (resides at woocommerce/src/Internal/Admin/ProductReviews/Reviews.php)
As you can see on the snippet, $this->reviews_list_table->display() is being overridden by a CustomReviewsListTable class. The CustomReviewsListTable is equivalent to ReviewsListTable.php file but with a modified version of the handle_row_actions method to insert a custom "Review action links".
Hope this information helps.