WPSEO_Plugin_Importer::detect()protectedYoast 1.0

Detects whether there is post meta data to import.

Метод класса: WPSEO_Plugin_Importer{}

Хуков нет.

Возвращает

true|false. Boolean indicating whether there is something to import.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->detect();

Код WPSEO_Plugin_Importer::detect() Yoast 22.4

protected function detect() {
	global $wpdb;

	$meta_keys = wp_list_pluck( $this->clone_keys, 'old_key' );
	$result    = $wpdb->get_var(
		$wpdb->prepare(
			"SELECT COUNT(*) AS `count`
				FROM {$wpdb->postmeta}
				WHERE meta_key IN ( " . implode( ', ', array_fill( 0, count( $meta_keys ), '%s' ) ) . ' )',
			$meta_keys
		)
	);

	if ( $result === '0' ) {
		return false;
	}

	return true;
}