Look at this section: Tag parameters in WP Codex, where is explained search by tags.
Your code like right. Try change numberposts to int:
<?php $args = array(
'numberposts' => 3,
'post_status' => 'publish',
'tag' => 'travel'
);
Related Posts:
- How to Display Post View Count
- Function to show random posts from a category
- Hiding posts in a list from specified categories
- Order posts alphabetically: how to set order=asc in mysql query?
- How to only publish posts with image in it
- How to check in functions.php if there is data in a WP_Query?
- Query function not executed between element [closed]
- How to correctly escape data
- How to limit the number of results for all query_posts on mysite
- wp trim function not working
- Keep featured content post in homepage with original order
- How to change the case of all post titles to “Title Case”
- Number of posts per page setting is not working?
- List only child categories a post is in, of a specific parent category
- Can’t show comments count per post outside loop
- How to change post status from publish to draft using hook in wordpress?
- Order post by year DESC and month ASC
- Custom wp_trim_words() function not trimming right
- Allow role to delete posts but block him the wp-admin
- Why does `url_to_postid` return 0 when testing `page_for_posts` Page?
- WP_Query in functions.php overrides global $post object, even with wp_reset_query()
- Improving WP_Query for performance when random posts are ordered
- Action hook for new pending posts?
- Ajax posts filter by date, comments, top views, top likes
- Prepend or add an Image to the content of a Post
- Why content_arr[‘extended’] removes paragraph tags?
- How To Get Posts With A Specific Word
- Why WP_Query(‘showposts=5’) shows only 1 post?
- Why is querying posts messing up my pages?
- Display all posts that were published before full post on single.php
- Two loops, one AJAX loop, exclude posts in first loop from second loop, loops are in different files
- How to do set post permalinks using 6 digit random unique function?
- Multi row post list
- Display post x of y within category
- WordPress Automatic Filename Changer
- posts_per_page option limits the number of Gallery items
- Nested WP_Query breaking loop
- Adding bootstrap classes to video shortcodes
- Display Posts with template on a Page
- Query for first 3 posts to change the look and feel
- Add custom text automatically on each post
- On what hook can I get the queried object’s final state?
- How to give classname to post if post has no content?
- Get the most recently modified post date of most recently modified post
- Getting Whitescreen when publishing a post [closed]
- Add code to a specific post’s content
- Related Posts: Changing Function For Posts Per Page
- WordPress query portfolio posts
- Optimize CPT-function with a loop
- How to get posts ordered by using their categories?
- WP_Query articles order by offset in collumns
- Display 3 posts with different HTML markup using a loop
- Getting posts from some categories plus some individual posts
- Making a wordpress page print friendly
- How to assign a post to a post parrent?
- get parent fields title, content excerpt etc
- Set Default Post as Parent Child (Nested) Relation
- AWS usage queries
- I need to create “View Profile” and “Edit Profile” links by incorporating the Post Title/ID, but can’t seem to manage it
- How to merge the content of posts that have the same title?
- How to put the author of the post in the comments?
- Check if almost 10 year old – working code is up to date
- How to fetch courses in all languages in WordPress?
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- Function is printing twice – any suggestions?
- How can I use query_posts to loop through posts and construct my own content?
- I want to change the WordPress comments file
- Excluding tag Link from html tags in Post content
- Save All Post Permalink From A Specific Category into a .txt file
- Assign a day of the week to post, e.g: Assign Monday to post and have it only appear when the day is Monday
- Changing a users posts to drafts upon role change
- Show 5 posts and than 3 posts offset with pagination
- How to Display Most View Post in the template file?
- wp_query args with relation
- Show post excerpt
- Querying posts from current category, using a variable as array argument
- How do I apply a wordpress function to something with no ID inside an archive page?
- Show all posts from the tags without having to set all of them
- Show author bio box
- Use special template for the first post in the loop
- Trim excerpt to first paragraph
- Need help writing loop to display posts by categories in separate divs
- Modify WordPress loop after it has been run
- Query post category & remove any post id
- Call image from post on index page?
- How to get only current images of a post
- Ordering posts alphabetically by meta keys and title
- How to edit label_submit styling?
- Why I have this strange behavior when I try to exlude the featured post from posts visualization?
- Remove duplicated posts in the loop if post has more than one category
- User driven content problems
- How to limit post query to only return a total count of items with certain post statuses?
- Not displaying any articles on a custom made file
- Notify Author of the post if admin deletes his post and perform some function
- How do we display a certain category type on a page while hiding all others?
- What function does the loop of displaying posts?
- Do I need to create a multisite for querying posts from multiple WordPress sites?
- Show Next/Previous without Link
- Dynamic archive of posts by date
- Filters do not work when there are multiple (one works)