$wpdb::get_results()
returns a list of objects by default, where each property is a column. The table wp_posts
doesn’t have a column coluna_teste
, therefore the mistake.
The code below is correct and will bring the titles:
global $wpdb;
// Para tabelas padrãdo do WP Use $wpdb->nomedatabela para buscar o nome
// já com o prefixo, que pode não ser o mesmo em todos os ambientes
$result = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} LIMIT 10" );
foreach ( $result as $row ) {
echo '<p>' . $row->post_title . '</p>';
}
Complete documentation of the class $wpdb
PS: The result of this query is the same as get_posts()
. Using the function is preferable.
Are you with exactly these parameters? because really everything is wrong that way
– Daniel Costa