Retrieve WordPress database table names and print them out

Simply we can retrieve table names from WordPress database.

$sql = "SHOW TABLES LIKE '%'";
$results = $wpdb->get_results($sql);

foreach($results as $index => $value) {
    foreach($value as $tableName) {
        echo $tableName . '<br />';
    }
}

The => will separate the key and value from a multidimensional array.
Happy Coding!

Leave a Reply