I have a loop that displays three custom post types.
Thing is, all of these post types use a different logic. 'elemzesek' and 'gyorshirek' use ACF fields which you can see in the meta_query.
However, the 'cikkek' post type, to display the correct articles, would need a
'tag' => get_the_title();
The problem is, if this is added, and it runs for 'elemzesek' and 'gyorshirek' as well, the loops finds no results.
Can someone help me in achieving this?
<?php
$ceg = get_the_title();
$ceg_megadasa = get_field('ceg_megadasa');
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$query = new WP_Query( array(
'post_type' => array('cikkek', 'elemzesek', 'gyorshirek'),
'posts_per_page' => 10,
'paged' => $paged,
'post_status' => 'publish',
// 'tag' => $ceg,
'orderby' => 'date',
'order' => 'DESC',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'ceg_megadasa',
'value' => get_the_ID()
),
array(
'key' => 'ceg_megadasa_gyorshirek',
'value' => get_the_ID()
),
)
) );
?>