• Hello,

    I want to list the specific post’s comments in a file.

    I used

    if ( !defined('WP_LOAD_PATH') ) {
    
    	/** classic root path if wp-content and plugins is below wp-config.php */
    	$classic_root = dirname(dirname(dirname(dirname(__FILE__)))) . '/' ;
    
    	if (file_exists( $classic_root . 'wp-load.php') )
    		define( 'WP_LOAD_PATH', $classic_root);
    	else
    		if (file_exists( $path . 'wp-load.php') )
    			define( 'WP_LOAD_PATH', $path);
    		else
    			exit("Could not find wp-load.php");
    }
    // let's load WordPress
    require_once( WP_LOAD_PATH . 'wp-load.php');
    
    ?>

    to load wordpress in a file named load-comments.php

    Then i used wp_list_comments(); to list the comments.

    But i know that the function is outside post loop so i am not able to list the comments. The thing i want is

    $post_id = "5 or 6 or 7, i will change this using parameters" ;
    wp_list_comments();

    Hope you understand my problem

The topic ‘how to list comments outside wordpress using wp_list_comments’ is closed to new replies.