Query posts only without featured image

Try this code , its working for me value=>’?’ because(value was required for NOT EXISTS comparisons to work correctly prior to 3.9. You had to supply some string for the value parameter. An empty string or NULL will NOT work. However, any other string will do the trick and will NOT show up in your … Read more

Assign custom parameter to each post in query

It’s a neat idea! The way I would tackle the problem is to create an associative array of post IDs mapped to their individual weights. Since weights are subjective – that is, the represent the value of other posts’ relationships with the post currently being displayed – it doesn’t make much sense to store these … Read more

How do I amend wp_query before it is run/executed?

Use pre_get_posts to modify the query object before the query has run. – https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-1,-1347’ ); } else if ($query->is_search) { $query->set( ‘s’, ‘stackoverflow’ ); } } add_action( ‘pre_get_posts’, ‘exclude_category’ );

Custom query with meta_key not working fine

@Rod0n WP version 4.2 included the number of improvements in WP_QUERY particularly when use the ‘meta_query’ parameter. Also, check the WP_QUERY Class Refernece. $args = array( ‘post_type’ => ‘proyectos’ , ‘posts_per_page’ => 8 , ‘paged’ => $paged, ‘orderby’ => array( ‘meta_value’ => ‘DESC’ ), ‘meta_query’ => array( array( ‘key’ => ‘wpcf-estado’, ‘compare’ => ‘EXISTS’, ), … Read more