Add category selection to function request
Instead of a sql query, I recommend to do it in wordpress way: $args = array( ‘numberposts’ => 3, ‘offset’ => 0, ‘category’ => put_your_category_id_here, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘suppress_filters’ => true ); $request = wp_get_recent_posts( $args, ARRAY_A ); Reference : WordPress Update : here is the … Read more