GET /read/tags/$tag/posts

Get a list of posts from a tag.

Resource Information

   
Method GET
URL https://public-api.wordpress.com/rest/v1.1/read/tags/$tag/posts
Requires authentication? No

Method Parameters

Parameter Type Description
$tag (string) The tag name

Query Parameters

Parameter Type Description
http_envelope (bool)
false:
(default)
true:
Some environments (like in-browser Javascript or Flash) block or divert responses with a non-200 HTTP status code. Setting this parameter will force the HTTP status code to always be 200. The JSON response is wrapped in an "envelope" containing the "real" HTTP status code and headers.
pretty (bool)
false:
(default)
true:
Output pretty JSON
meta (string) Optional. Loads data from the endpoints found in the 'meta' part of the response. Comma-separated list. Example: meta=site,likes
fields (string) Optional. Returns specified fields only. Comma-separated list. Example: fields=ID,title
callback (string) An optional JSONP callback function.
number (int) The number of posts to return. Limit: 40. Default: 10.
page (int) Return the Nth 1-indexed page of posts.
order (string)
DESC:
(default) Return posts in descending order. For dates, that means newest to oldest.
ASC:
Return posts in ascending order. For dates, that means oldest to newest.
after (iso 8601 datetime) Return posts dated after the specified datetime.
before (iso 8601 datetime) Return posts dated before the specified datetime.

Response Parameters

Parameter Type Description
ID (int) The post ID.
site_ID (int) The site ID.
author (object) The author of the post.
date (iso 8601 datetime) The post's creation time.
modified (iso 8601 datetime) The post's most recent update time.
title (html) context dependent.
URL (url) The full permalink URL to the post.
short_URL (url) The wp.me short URL.
content (html) context dependent.
excerpt (html) context dependent.
slug (string) The name (slug) for the post, used in URLs.
guid (string) The GUID for the post.
status (string)
publish:
The post is published.
draft:
The post is saved as a draft.
pending:
The post is pending editorial approval.
private:
The post is published privately
future:
The post is scheduled for future publishing.
trash:
The post is in the trash.
auto-draft:
The post is a placeholder for a new post.
sticky (bool) Is the post sticky?
password (string) The plaintext password protecting the post, or, more likely, the empty string if the post is not password protected.
parent (object|false) A reference to the post's parent, if it has one.
type (string) The post's post_type. Post types besides post, page and revision need to be whitelisted using the rest_api_allowed_post_types filter.
comments_open (bool) Is the post open for comments?
pings_open (bool) Is the post open for pingbacks, trackbacks?
likes_enabled (bool) Is the post open to likes?
sharing_enabled (bool) Should sharing buttons show on this post?
comment_count (int) The number of comments for this post.
like_count (int) The number of likes for this post.
i_like (bool) Does the current user like this post?
is_reblogged (bool) Did the current user reblog this post?
is_following (bool) Is the current user following this blog?
global_ID (string) A unique WordPress.com-wide representation of a post.
featured_image (url) The URL to the featured image for this post if it has one.
post_thumbnail (object) The attachment object for the featured image if it has one.
format (string)
standard:
Standard
aside:
Aside
chat:
Chat
gallery:
Gallery
link:
Link
image:
Image
quote:
Quote
status:
Status
video:
Video
audio:
Audio
geo (object|false)
menu_order (int) (Pages Only) The order pages should appear in.
publicize_URLs (array) Array of Twitter and Facebook URLs published by this post.
tags (object) Hash of tags (keyed by tag name) applied to the post.
categories (object) Hash of categories (keyed by category name) applied to the post.
attachments (object) Hash of post attachments (keyed by attachment ID).
metadata (array) Array of post metadata keys and values. All unprotected meta keys are available by default for read requests. Both unprotected and protected meta keys are available for authenticated requests with access. Protected meta keys can be made available with the rest_api_allowed_public_metadata filter.
meta (object) API result meta data
current_user_can (object) List of permissions. Note, deprecated in favor of `capabilities`
capabilities (object) List of post-specific permissions for the user; publish_post, edit_post, delete_post
date_range (object) date range covered by current results.
number (int) The number of posts brought back by current query.
posts (array) An array of post objects.

Resource Errors

These are the possible errors returned by this endpoint.

HTTP Code Error Identifier Error Message
403 unauthorized User cannot view taxonomy
403 unauthorized User cannot view post
400 invalid_topic The TOPIC parameter must be specified.
400 invalid_tag The TAG requested does not seem to be a valid tag.
403 unauthorized User cannot edit taxonomy
400 invalid_post Invalid post
400 invalid_context Invalid API CONTEXT
403 unauthorized User cannot edit post
404 unknown_post Unknown post

Example

curl 'https://public-api.wordpress.com/rest/v1/read/tags/wordpress/posts/?number=2'
<?php
$options  = array (
  'http' => 
  array (
    'ignore_errors' => true,
  ),
);

$context  = stream_context_create( $options );
$response = file_get_contents(
	'https://public-api.wordpress.com/rest/v1/read/tags/wordpress/posts/?number=2',
	false,
	$context
);
$response = json_decode( $response );
?>

Response

{
    "date_range": {
        "before": "2016-02-06T05:30:17+00:00",
        "after": "2016-02-06T05:30:08+00:00"
    },
    "number": 2,
    "posts": [
        {
            "ID": 6563,
            "site_ID": 101641095,
            "author": {
                "ID": 96578982,
                "login": "lovelyreadspublishing",
                "email": false,
                "name": "Lovely Reads Publishing",
                "first_name": "",
                "last_name": "",
                "nice_name": "lovelyreadspublishing",
                "URL": "http:\/\/lovelyreadspublishing.wordpress.com",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/0f83521c76861aa3f2dbea062551ba22?s=96&d=identicon&r=G",
                "profile_URL": "http:\/\/en.gravatar.com\/lovelyreadspublishing",
                "site_ID": 101641095
            },
            "date": "2016-02-06T05:30:17+00:00",
            "modified": "2016-02-06T05:30:17+00:00",
            "title": "The Burning Offer",
            "URL": "https:\/\/lovelyreadspublishing.wordpress.com\/2016\/02\/06\/the-burning-offer\/",
            "short_URL": "http:\/\/wp.me\/p6Stuv-1HR",
            "content": "<div style=\"margin:0 auto 15px;text-align:center;\">\n<span style=\"font-family:Arial, Helvetica, sans-serif;\"><a href=\"http:\/\/ift.tt\/15aQw7n\" target=\"_blank\"><br \/>\n<img alt=\"\" src=\"http:\/\/ift.tt\/1PqdlJ0\" height=\"148\" style=\"height:auto;max-width:100%;\" width=\"400\" \/><br \/>\n<\/a><br \/>\n<\/span><\/div>\n<p><img alt=\"\" src=\"http:\/\/ift.tt\/1SS2snS\" height=\"400\" style=\"display:inline-block;float:left;margin:0 15px 15px 0;\" width=\"266\" \/><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\"><strong>The Burning Offer<\/strong><br \/><strong>Aubrey Parker<\/strong><br \/>(Trevor\u2019s Harem, #1)<br \/>Publication date: February 2nd 2016<br \/>Genres: New Adult, Romance<\/span><\/p>\n<blockquote><p>\n<b><span style=\"font-family:Arial, Helvetica, sans-serif;\">The anonymous invitation that someone slipped under my door promises $1,000. Just for meeting a man downtown, in a public place, no questions asked.<\/span><\/b><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">I can make more than I ever imagined if I agree to take part in a competition.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">Just get into the limousine. Just get on the private plane. Just fly to an airstrip at the foot of the largest, most luxurious estate I\u2019ve ever seen. Just stay the first night, then another. Tell no one where I\u2019ve gone, or why.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">Everything in me screams to run away.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">The rules say I can leave whenever I want.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">So why am I still here?<\/span><\/p><\/blockquote>\n<div style=\"font-weight:bold;text-align:center;\">\n<span style=\"font-family:Arial, Helvetica, sans-serif;\"><br \/><\/span><\/div>\n<div style=\"font-weight:bold;text-align:center;\">\n<span style=\"font-family:Arial, Helvetica, sans-serif;\"><br \/><\/span><\/div>\n<div style=\"font-weight:bold;text-align:center;\">\n<span style=\"font-family:Arial, Helvetica, sans-serif;\"><br \/><\/span><\/div>\n<div style=\"font-weight:bold;text-align:center;\">\n<span style=\"font-family:Arial, Helvetica, sans-serif;\"><a href=\"http:\/\/ift.tt\/1Pqdnkk\" target=\"_blank\">Goodreads<\/a> \/ <a href=\"http:\/\/ift.tt\/1SS2snW\" target=\"_blank\">Amazon<\/a><\/span><\/div>\n<div style=\"font-weight:bold;text-align:center;\">\n<\/div>\n<div style=\"text-align:center;\">\n<strong><span style=\"font-family:Arial, Helvetica, sans-serif;\">EXCERPT:<\/span><\/strong><\/div>\n<p><span style=\"font-family:Arial, Helvetica, sans-serif;\">\u201cAs I\u2019m sure you\u2019ve figured out,\u201d Daniel says, \u201cyou\u2019re here for a competition. You\u2019ve probably also predicted some of the nature of this contest, though I assure you, you could not have predicted it all. Some of you have, quite separately, decided to mingle with these three fine young men here and with each other. That is, of course, your business. Not something we\u2019ve asked or requested in any way.\u201d<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">Some of the girls look at each other, and even though I don\u2019t want to, I find my eyes turning toward Erin\u2019s. She still won\u2019t look at me. It\u2019s the oddest thing. She and Jessica don\u2019t strike me like the others do, though it\u2019s possible that\u2019s only because the three of us are the newest. But I\u2019d swear, we seem like three peas in a pod. Girls who aren\u2019t right for this scene, even if Erin proved me wrong. Maybe that\u2019s why she\u2019s looking away \u2014 because she thinks I\u2019m judging her. It\u2019s also possible, given what happened and the way she looked at me back in my room, that she\u2019s interested in me the way she was in Tony.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">Still, something is wrong here. Something I\u2019m missing.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">Daniel has paused for a few meaningful seconds. I know what he\u2019s doing \u2014reminding them all that just because some billionaire invited them over and they decided to start screwing around with each other, there was and won\u2019t be any coercion. I\u2019d guess it\u2019s also drawing the first of many lines between the contestants: those who were proactive enough to act early, those who abstained, and those who got their rocks off because they were horny \u2014 all contest considerations aside.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">My mind flashes back to the mind games Daniel played with me when we met. Games at the website on the card included with my invitation. The survey. The interview. Little things, like Daniel tricking me into admissions I didn\u2019t want to make.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">\u201cIf your guesses about this competition in any way make you uncomfortable,\u201d Daniel continues, \u201cI\u2019ll ask you to let us know now. I\u2019ll have one of our pilots fly you back the second you\u2019re ready to go, and we will pay you five thousand dollars for leaving.\u201d<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">He looks around the room. His eyes stop on me for a fraction of a second too long, and a few more heads turn before he moves on.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">Five thousand isn\u2019t enough.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">Come hell or high water, I\u2019ll stay until morning.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">\u201cBy staying past the end of this sentence,\u201d Daniel says, \u201cyou are waiving your right to any action against anyone here barring overt criminal behavior, as stipulated in the contract you signed earlier.\u201d<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">My brow furrows. Contract? I didn\u2019t sign any contract.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">He pauses again.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">\u201cPerfect,\u201d Daniel says when no one objects.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">He turns to Trevor, who again stands. The two men nod mutual thanks, and Daniel sits in his chair beside the throne.<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">\u201cI guess I\u2019ll take it from here,\u201d Trevor says, smiling down at Daniel, \u201csince I\u2019m the one looking for a bride.\u201d<\/span><br \/>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\"><br class=\"blank\" \/><\/span><br \/>\n<img alt=\"\" src=\"http:\/\/ift.tt\/1PqdlJ6\" style=\"display:inline-block;float:left;margin:0 15px 15px 0;\" \/><b style=\"font-family:Arial, Helvetica, sans-serif;\">Author Bio:<\/b><\/p>\n<blockquote style=\"margin-bottom:15px;margin-top:15px;\"><p>\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">I love to write stories with characters that feel real enough to friend on Facebook, or slap across the face. I write to make you feel, think, and burn with the thrill that can only come from getting lost in the pages. I love to write unforgettable characters who wrestle with life’s largest problems. My books may always end with a Happily Ever After, but there will always be drama on the way there.<\/span><\/p>\n<div style=\"text-align:center;\">\n<span style=\"font-family:Arial, Helvetica, sans-serif;\"><a href=\"http:\/\/ift.tt\/1SS2snX\" target=\"_blank\">Website<\/a> \/ <a href=\"http:\/\/ift.tt\/1SS2ts9\" target=\"_blank\">Goodreads<\/a> \/ <a href=\"https:\/\/twitter.com\/aubreyparker11\" target=\"_blank\">Twitter<\/a> \/ <a href=\"http:\/\/ift.tt\/1PqdlJa\" target=\"_blank\">Facebook<\/a><\/span><\/div>\n<\/blockquote>\n<p><span style=\"font-family:Arial, Helvetica, sans-serif;\"><br class=\"blank\" \/><\/span><\/p>\n<div style=\"text-align:center;\">\n<span style=\"font-family:Arial, Helvetica, sans-serif;\"><strong>GIVEAWAY!<\/strong><\/p>\n<p><a class=\"rcptr\" href=\"http:\/\/ift.tt\/1SS2snZ\" id=\"rcwidget_efb3b61h\" rel=\"nofollow\">a Rafflecopter giveaway<\/a><\/p>\n<p><a href=\"http:\/\/ift.tt\/1viXyY4\">http:\/\/ift.tt\/1viXyY4<\/a><\/span><\/div>\n<div style=\"text-align:center;\">\n<span style=\"font-family:Arial, Helvetica, sans-serif;\">Hosted by:<\/p>\n<p><a href=\"http:\/\/ift.tt\/15aQw7n\"><img alt=\"ButtonXBT1\" class=\"alignnone size-full wp-image-11667\" src=\"http:\/\/ift.tt\/1XEluiV\" height=\"280\" width=\"280\" \/><\/a><\/span><\/div>\n",
            "excerpt": "<p>The Burning OfferAubrey Parker(Trevor\u2019s Harem, #1)Publication date: February 2nd 2016Genres: New Adult, Romance The anonymous invitation that someone slipped under my door promises $1,000. Just for meeting a man downtown, in a public place, no questions asked. I can make more than I ever imagined if I agree to take part in a competition. Just [&hellip;]<\/p>\n",
            "slug": "the-burning-offer",
            "guid": "https:\/\/lovelyreadspublishing.wordpress.com\/?p=6563",
            "status": "publish",
            "sticky": false,
            "password": "",
            "parent": false,
            "type": "post",
            "comments_open": true,
            "pings_open": true,
            "likes_enabled": true,
            "sharing_enabled": true,
            "comment_count": 0,
            "like_count": 0,
            "i_like": 0,
            "is_reblogged": 0,
            "is_following": 0,
            "global_ID": "4b97e147f947a7d2d78c46cecebd4202",
            "featured_image": "",
            "post_thumbnail": null,
            "format": "standard",
            "geo": false,
            "menu_order": 0,
            "publicize_URLs": [],
            "tags": {
                "Wordpress": {
                    "ID": 33,
                    "name": "Wordpress",
                    "slug": "wordpress",
                    "description": "",
                    "post_count": 172,
                    "meta": {
                        "links": {
                            "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095\/tags\/slug:wordpress",
                            "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095\/tags\/slug:wordpress\/help",
                            "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095"
                        }
                    }
                }
            },
            "categories": {
                "Uncategorized": {
                    "ID": 1,
                    "name": "Uncategorized",
                    "slug": "uncategorized",
                    "description": "",
                    "post_count": 2230,
                    "parent": 0,
                    "meta": {
                        "links": {
                            "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095\/categories\/slug:uncategorized",
                            "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095\/categories\/slug:uncategorized\/help",
                            "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095"
                        }
                    }
                }
            },
            "attachments": {},
            "metadata": false,
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095\/posts\/6563",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095\/posts\/6563\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095\/posts\/6563\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/101641095\/posts\/6563\/likes\/"
                }
            },
            "current_user_can": {
                "publish_post": false,
                "delete_post": false,
                "edit_post": false
            },
            "capabilities": {
                "publish_post": false,
                "delete_post": false,
                "edit_post": false
            },
            "pseudo_ID": "4b97e147f947a7d2d78c46cecebd4202",
            "is_external": false,
            "site_name": "Lovely Reads Publishing",
            "site_URL": "https:\/\/lovelyreadspublishing.wordpress.com",
            "site_is_private": false,
            "featured_media": {}
        },
        {
            "ID": 23106,
            "site_ID": 25651340,
            "author": {
                "ID": 526640,
                "login": "wanagi",
                "email": false,
                "name": "Thorsten",
                "first_name": "Thorsten",
                "last_name": "Ott",
                "nice_name": "wanagi",
                "URL": "http:\/\/webzappr.com",
                "avatar_URL": "https:\/\/0.gravatar.com\/avatar\/9e8f7fd87fd2163010f98280f3e45a35?s=96&d=identicon&r=G",
                "profile_URL": "http:\/\/en.gravatar.com\/wanagi",
                "site_ID": 5132227
            },
            "date": "2016-02-06T05:30:08+00:00",
            "modified": "2016-02-06T05:30:08+00:00",
            "title": "Changeset 36485 – WordPress Trac",
            "URL": "http:\/\/wp-cron.com\/2016\/02\/06\/changeset-36485-wordpress-trac\/",
            "short_URL": "http:\/\/wp.me\/p1JD5i-60G",
            "content": "<p>As a byproduct of these improvements, $meta_key and $meta_value parameters have been introduced to get_terms(). They interact with $meta_query in the same way as in WP_Query and other query classes.<\/p>\n<p><a class='content-link' href='https:\/\/core.trac.wordpress.org\/changeset\/36485' title='Changeset 36485 - WordPress Trac'>visit WordPress<\/a><\/p>\n",
            "excerpt": "<p>As a byproduct of these improvements, $meta_key and $meta_value parameters have been introduced to get_terms(). They interact with $meta_query in the same way as in WP_Query and other query classes. visit WordPress<\/p>\n",
            "slug": "changeset-36485-wordpress-trac",
            "guid": "http:\/\/wp-cron.com\/2016\/02\/06\/changeset-36485-wordpress-trac\/",
            "status": "publish",
            "sticky": false,
            "password": "",
            "parent": false,
            "type": "post",
            "comments_open": true,
            "pings_open": false,
            "likes_enabled": true,
            "sharing_enabled": true,
            "comment_count": 0,
            "like_count": 1,
            "i_like": 0,
            "is_reblogged": 0,
            "is_following": 0,
            "global_ID": "e92fe3c782898b55653a1440626978b9",
            "featured_image": "",
            "post_thumbnail": null,
            "format": "standard",
            "geo": false,
            "menu_order": 0,
            "publicize_URLs": [],
            "tags": {
                "2a218be4debe9b46d9733ed063800220": {
                    "ID": 453632430,
                    "name": "2a218be4debe9b46d9733ed063800220",
                    "slug": "2a218be4debe9b46d9733ed063800220",
                    "description": "",
                    "post_count": 1,
                    "meta": {
                        "links": {
                            "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340\/tags\/slug:2a218be4debe9b46d9733ed063800220",
                            "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340\/tags\/slug:2a218be4debe9b46d9733ed063800220\/help",
                            "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340"
                        }
                    }
                }
            },
            "categories": {
                "Wordpress": {
                    "ID": 33,
                    "name": "Wordpress",
                    "slug": "wordpress",
                    "description": "",
                    "post_count": 577,
                    "parent": 0,
                    "meta": {
                        "links": {
                            "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340\/categories\/slug:wordpress",
                            "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340\/categories\/slug:wordpress\/help",
                            "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340"
                        }
                    }
                }
            },
            "attachments": {},
            "metadata": [
                {
                    "id": "200222",
                    "key": "_wpas_done_6648858",
                    "value": "1"
                },
                {
                    "id": "200226",
                    "key": "_wpas_done_6660591",
                    "value": "1"
                }
            ],
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340\/posts\/23106",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340\/posts\/23106\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340\/posts\/23106\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/25651340\/posts\/23106\/likes\/"
                }
            },
            "current_user_can": {
                "publish_post": false,
                "delete_post": false,
                "edit_post": false
            },
            "capabilities": {
                "publish_post": false,
                "delete_post": false,
                "edit_post": false
            },
            "pseudo_ID": "e92fe3c782898b55653a1440626978b9",
            "is_external": false,
            "site_name": "The WordPress C(h)ronicle",
            "site_URL": "http:\/\/wp-cron.com",
            "site_is_private": false,
            "featured_media": {}
        }
    ]
}