how to modify select columns returned by wp_query?
-
Good Day,
i’m using the wp_query as new WP_Query( array( ‘category_name’ => ‘cat 1’, ‘posts_per_page’ => -1, ‘post_status’ => ‘publish’ ) ); and its returning the results properly
although in this specific query. I only want to fetch the wp_posts.ID, wp_posts.post_data, and wp_posts.post_title
These 3 columns are only what I want from my query.
Is this possible to do in pre_get_posts hook? The only samples I see is how you can edit the where clause but not the select columns. And also let say I’m not allowed to use $wpdb->get_results custom sql.thanks
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘how to modify select columns returned by wp_query?’ is closed to new replies.