tables() публичный Метод

Also allows for the CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE to override the WordPress users and usermeta tables that would otherwise be determined by the prefix. The scope argument can take one of the following: 'all' - returns 'all' and 'global' tables. No old tables are returned. 'blog' - returns the blog-level tables for the queried blog. 'global' - returns the global tables for the installation, returning multisite tables only if running multisite. 'ms_global' - returns the multisite global tables, regardless if current installation is multisite. 'old' - returns tables which are deprecated.
С версии: 3.0.0
public tables ( string $scope = 'all', boolean $prefix = true, integer $blog_id ) : array
$scope string Optional. Can be all, global, ms_global, blog, or old tables. Defaults to all.
$prefix boolean Optional. Whether to include table prefixes. Default true. If blog prefix is requested, then the custom users and usermeta tables will be mapped.
$blog_id integer Optional. The blog_id to prefix. Defaults to wpdb::$blogid. Used only when prefix is requested.
Результат array Table names. When a prefix is requested, the key is the unprefixed table name.
Пример #1
0
 /**
  * Checks if some tables with the given prefix exist in the database
  *
  * @param string $dbUser
  * @param string $dbPassword
  * @param string $dbName
  * @param string $dbHost
  * @param string $dbPrefix
  * @return bool
  */
 private function someWpTablesExist($dbUser, $dbPassword, $dbName, $dbHost, $dbPrefix)
 {
     $wpdb = new \wpdb($dbUser, $dbPassword, $dbName, $dbHost);
     $wpdb->set_prefix($dbPrefix);
     $tables = $wpdb->get_col("SHOW TABLES LIKE '{$dbPrefix}_%'");
     $wpTables = array_intersect($tables, $wpdb->tables());
     return count($wpTables) > 0;
 }