Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // WooCommerce - List current user's reviews
- // code goes in functions.php for child theme
- // Usage: [show_my_reviews]
- // No parameters
- // not tested
- add_shortcode( 'my_reviews', 'show_my_reviews' );
- function show_my_reviews() {
- $current_user = wp_get_current_user();
- $args = array (
- 'post_type' => 'product',
- 'user_id' => $current_user->ID
- );
- $comments = get_comments( $args );
- wp_list_comments( array( 'callback' => 'woocommerce_comments' ), $comments);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement