• in my custom_plugin.php im trying to retrieve the pages on my database using this statement below.

    but i dont get any results

    global $wpdb;
    
        $posts = $wpdb->wp_posts;
        $result = $wpdb->get_results( " SELECT * FROM  $posts WHERE 'post_type' =  'page' "  );
    
        foreach ($result as $page) {
                echo $page->ID.'<br/>';
    
        }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘cannot retrieve data using $wpdb’ is closed to new replies.