How can I show posts with the same tag?
How can I show posts with the same tag?
How can I show posts with the same tag?
get the queried_object of an url
List categories using WP_Query
The issue can be solved with this code : function my_cpt_query( $query ) { $myPostObjetField= get_field(‘cpt1_field_for_cpt2’,$post_id,false); foreach( $myPostObjetField as $post_field_item_value ) { $ids[] = (int) $post_field_item_value; } $query->set( ‘post_type’, ‘CPT2’); $query->set( ‘post__in’, $ids); } add_action( ‘elementor/query/13600’, ‘my_cpt_query’ );
For anyone visiting this topic in the future, I will form an answer of my comment. The reason for this issue was the use of $category inside the tax_query. The get_terms function return terms as entire objects by default. The tax_query expects an ID (or an array of IDs). This caused issues with the execution … Read more
Woocommerce set loop_shop_columns to be 3 in the main shop page loop only and 4 otherwise
SQL query into to WP query
WP query with multiple custom meta not respecting orderby
WordPress does not include any functionality to directly acquire a list of Post IDs and meta values by meta-key. The most direct solution is to query for all posts which have the meta key, then access their respective meta values afterwards. While it’s possible to execute a SQL query to produce such a list, the … Read more
Refresh wp_query with no changes