wordpress - Retrieve product comments woocommerce -


i'm trying retrieve product comments on different section of page. i'm using:

$args = array (   'post_id' => $post->id,   'status' => 'approve',   'number' => '3',   );     $comments = get_comments( $args );      wp_list_comments( array( 'callback' => 'woocommerce_comments' ), $comments); 

i tried change 'post_id' null, 0.

the problem comments of products being displayed, not 1 i'm seeing.

is there i'm doing wrong? thanks!

edit ---

found solution, added global $post; before code.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -