wordpressを使用した、ブログ等のカスタマイズで記事詳細ページで同じタグが付いた記事を呼びたい時のメモ。 wordpress見ている記事(シングルページ)に同一タグの記事を呼び出す <?php $original_post = $post; $tags = wp_get_post_tags($post->ID); $tagIDs = array(); if ($tags) { $tagcount = count($tags); for ($i = 0; $i < $tagcount; $i++) { $tagIDs[$i] = $tags[$i]->term_id; } $args=array( 'tag__in' => $tagIDs, 'post__not_in' => array($post->ID), 'showposts'=>4, 'ignore_sticky_posts'
![wp個別記事ページに同一タグの記事を表示する - luladesign 長野県上田市、ウェブ制作、ホームページ制作、DTPデザイン制作](https://cdn-ak-scissors.b.st-hatena.com/image/square/ac83a779e45f393baf90d319771a73570cc9e984/height=288;version=1;width=512/https%3A%2F%2Flula.work%2Fwp%2Fwp-content%2Fuploads%2F2016%2F02%2Fwp_hack-1.jpg)