Yoast\WP\SEO\Helpers
Wpdb_Helper::table_exists
Check if table exists.
Метод класса: Wpdb_Helper{}
Хуков нет.
Возвращает
true|false. Whether the table exists.
Использование
$Wpdb_Helper = new Wpdb_Helper(); $Wpdb_Helper->table_exists( $table );
- $table(строка) (обязательный)
- The table to be checked.
Код Wpdb_Helper::table_exists() Wpdb Helper::table exists Yoast 28.0
public function table_exists( $table ) {
// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery,WordPress.DB.DirectDatabaseQuery.NoCaching,WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Reason: There is no unescaped user input.
$table_exists = $this->wpdb->get_var( "SHOW TABLES LIKE '{$table}'" );
if ( \is_wp_error( $table_exists ) || $table_exists === null ) {
return false;
}
return true;
}