WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
функция не описана

WP_Importer::get_imported_comments() public WP 1.0

Set array with imported comments from WordPress database

Это метод класса: WP_Importer{}

Хуков нет.

Возвращает

Массив.

Использование

$WP_Importer = new WP_Importer();
$WP_Importer->get_imported_comments( $bid );
$bid(строка) (обязательный)

Заметки

  • Global. wpdb. $wpdb WordPress database abstraction object.

Код WP_Importer::get_imported_comments() WP 5.5.1

wp-admin/includes/class-wp-importer.php
<?php
public function get_imported_comments( $bid ) {
	global $wpdb;

	$hashtable = array();

	$limit  = 100;
	$offset = 0;

	// Grab all comments in chunks.
	do {
		$sql     = $wpdb->prepare( "SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit );
		$results = $wpdb->get_results( $sql );

		// Increment offset.
		$offset = ( $limit + $offset );

		if ( ! empty( $results ) ) {
			foreach ( $results as $r ) {
				// Explode comment_agent key.
				list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent );
				$source_comment_id                   = intval( $source_comment_id );

				// Check if this comment came from this blog.
				if ( $bid == $ca_bid ) {
					$hashtable[ $source_comment_id ] = intval( $r->comment_ID );
				}
			}
		}
	} while ( count( $results ) == $limit );

	// Unset to save memory.
	unset( $results, $r );

	return $hashtable;
}