WP PHP obtiene el número de filas de MySQL

function get_number_of_db_rows($table_name)
{
    global $wpdb;
    $count_query = "select count(*) from $table_name";
    $num = $wpdb->get_var($count_query);
    return $num;
}
ahmad-ali14