I’ve written some code which automatically creates some posts and adds a tag to them. I can see the tags in the ‘All posts’ admin panel and I can click on the posts ‘Tag’ link to get just those posts with the tags.
Here is my code:
<?php $tag_ID= single_tag_title();
$args = array(
'post_type' => 'post',
'tag_id' => $tag_ID,
'posts_per_page' => 10,
'order' =>'ASC'
);
$posts = get_posts( $args );
var_dump($args );
foreach ( $posts as $post ) {
?>
Can you help me to get all tag posts?
Thank you.
Create a new file (tag.php) in
wp-content/themes/yourthemefolder/
and put below code in it.