get_posts returning empty array
Try “post_type” => array(‘carellcars’, ‘ccf’, ‘attachment’),
Try “post_type” => array(‘carellcars’, ‘ccf’, ‘attachment’),
Yes, and you can use the meta_key along with meta_value parameter. Secondly, you’re going to need two queries when there are no featured posts: Query the featured articles/posts: $q = new WP_Query( [ ‘post_type’ => ‘post’, ‘meta_key’ => ‘featured’, ‘meta_value’ => ‘1’, ‘posts_per_page’ => 3, ‘no_found_rows’ => true, ] ); Query random posts: $q = … Read more
Array merging multiple get_posts throwing Undefined offset error
How to Edit & Update meta_box values from Front-End user Form
How can I render more than multiple posts on template-parts with post formats
Exclude admins from query get posts
As mentioned in the comments you can query the postmeta table directly: public function get_metadata_keys(){ global $wpdb; $meta_query = $wpdb->get_results( ” SELECT DISTINCT meta_key FROM {$wpdb->postmeta} ” , ARRAY_A ); $meta_keys = wp_list_pluck( $meta_query, ‘meta_key’ ); return $meta_keys; } This will return the list of all meta_keys associated to any post.
I hate to tell you this, but you have a typo that’s causing the problem. ‘order ‘=>’asc’, should be ‘order’ => ‘asc’, (Notice the space inside the ‘order ‘ string.) If that’s not the issue, I’d to a string search on all the files in wp-content for pre_get_posts to see if the theme or a … Read more
I think I found how to do it: setting ‘numberposts’ => 1, will retrieve only one (the first) post.
How to mark only one post as Featured post?