前提・実現したいこと
ACFプラグインの投稿オブジェクトを利用して、投稿記事側で関連記事を表示してます。
それは問題なくできたのですが、
関連元側の記事で、それに紐づいてるのを一覧で出したいです。
このあたりを参考に下記コードを書いたのですが、なにも出てきませんでした。
ご教授よろしくお願いします。
該当のソースコード
<?php $postid = get_the_ID(); $args = array( 'post_type' => 'post', 'order' => 'DESC', 'post_status' => 'publish', 'meta_key' => 'relation', 'meta_value' => '"' . $postid . '"', 'meta_compare' => 'LIKE', 'posts_per_page' => '-1', 'paged' => $paged, ); ?> <?php if ($the_query->have_posts()):while($the_query->have_posts()):$the_query->the_post(); ?> hogehoge <?php endwhile; ?> <?php endif; ?>
あなたの回答
tips
プレビュー