[WordPress] 使用している全テーブルを取得

global $wpdb;
$wp_tables = array();
$pattern = '/^'. preg_quote($wpdb->prefix, '/') . '/i';
$tables = $wpdb->get_col('SHOW TABLES');
foreach ( $tables as $table ) {
    if ( preg_match( $pattern, $table ) ) {
        $wp_tables[] = $table;
    }
}

Posted

in

by

Tags:

Comments

コメントを残す