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
400 invalid_tag The tag requested does not seem to be valid.
403 unauthorized User cannot view taxonomy
403 unauthorized User cannot view post
400 invalid_topic The TOPIC parameter must be specified.
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": "2018-06-23T05:57:02+00:00",
        "after": "2018-06-23T05:55:47+00:00"
    },
    "number": 2,
    "posts": [
        {
            "ID": 28,
            "site_ID": 147820589,
            "author": {
                "ID": 140506783,
                "login": "kiathemesnew",
                "email": false,
                "name": "kiathemesnew",
                "first_name": "",
                "last_name": "",
                "nice_name": "kiathemesnew",
                "URL": "http:\/\/bestdirectorywordpressthemes.wordpress.com",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/e49ce9b19812231d7566c2f7001a009e?s=96&d=identicon&r=G",
                "profile_URL": "https:\/\/en.gravatar.com\/kiathemesnew",
                "ip_address": false,
                "site_ID": 147820589,
                "site_visible": true
            },
            "date": "2018-06-23T05:57:02+00:00",
            "modified": "2018-06-23T05:57:02+00:00",
            "title": "Free website themes for wordpress – Kia Themes",
            "URL": "https:\/\/bestdirectorywordpressthemes.wordpress.com\/2018\/06\/23\/free-website-themes-for-wordpress-kia-themes\/",
            "short_URL": "https:\/\/wp.me\/pa0eT3-s",
            "content": "<h2>Nancy – Blog\/Magzine WordPress Theme<\/h2>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.kiathemes.com\/product\/nancy-blog-magzine-wordpress-theme\/\"><img class=\"alignnone wp-image-1336 size-full\" src=\"https:\/\/www.kiathemes.com\/wp-content\/uploads\/2018\/06\/01_Home-Page-6.png\" alt=\"\" width=\"590\" height=\"300\" \/><\/a><\/p>\n<p><strong><a href=\"https:\/\/www.kiathemes.com\/product\/nancy-blog-magzine-wordpress-theme\/\">Nancy<\/a>\u00a0<\/strong>is\u00a0<strong>a\u00a0<\/strong>multi-purpose blog WordPress theme for Charity blogging business.\u00a0<strong><a href=\"https:\/\/www.kiathemes.com\/product\/nancy-blog-magzine-wordpress-theme\/\">Nancy<\/a>\u00a0<\/strong>has many useful features, its simple and easy to use, modern and creative, user-friendly, responsive design WordPress theme.<\/p>\n<p><strong>Main Features<\/strong>.<\/p>\n<ul>\n<li>Fully Responsive<\/li>\n<li>Multiple Headers<\/li>\n<li>Multiple Layouts<\/li>\n<li>Post Formats\n<ul>\n<li>Gallery Posts<\/li>\n<li>Video Posts<\/li>\n<li>image Posts<\/li>\n<li>Music Posts<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>Unlimited color options<\/li>\n<li>One Click Demo<\/li>\n<li>Responsive Design<\/li>\n<li>Multiple Header options<\/li>\n<li>Multiple Footer Styles<\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.kiathemes.com\/product\/nancy-blog-magzine-wordpress-theme\/\">Download Theme<\/a>\u00a0\u00a0 \u00a0 \u00a0<a href=\"http:\/\/www.kiathemes.in\/nancy\/\">View Demo<\/a><\/p>\n<p>&nbsp;<\/p>\n<h2>Fabrid – Blog\/Magzine WordPress Theme<\/h2>\n<p><a href=\"https:\/\/www.kiathemes.com\/product\/fabrid-blog-magzine-wordpress-theme\/\"><img class=\"alignnone wp-image-1338 size-full\" src=\"https:\/\/www.kiathemes.com\/wp-content\/uploads\/2018\/06\/01_Home-Page-7.png\" alt=\"\" width=\"590\" height=\"300\" \/><\/a><\/p>\n<p><a href=\"https:\/\/www.kiathemes.com\/product\/fabrid-blog-magzine-wordpress-theme\/\"><strong>Fabrid\u00a0<\/strong><\/a>is\u00a0<strong>a\u00a0<\/strong>multi-purpose blog WordPress theme for Personal blogging business. Fabrid<b>\u00a0<\/b>has many useful features, its simple and easy to use, modern and creative, user-friendly, responsive design WordPress theme.<\/p>\n<p><strong>Main Features<\/strong>.<\/p>\n<ul>\n<li>Multiple Headers<\/li>\n<li>Multiple Layouts<\/li>\n<li>Fully Responsive<\/li>\n<li>Post Formats\n<ul>\n<li>Gallery Posts<\/li>\n<li>Video Posts<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<ul>\n<li>Multiple Footer Styles<\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.kiathemes.com\/product\/fabrid-blog-magzine-wordpress-theme\/\">Download Theme<\/a>\u00a0\u00a0 \u00a0 \u00a0<a href=\"http:\/\/www.kiathemes.in\/fabrid\/\">View Demo<\/a><\/p>\n<div class=\"Mu SP\">\n<h2><strong>WPBoat \u2013 Boat &amp; Yacht Rental WordPress Theme<\/strong><\/h2>\n<\/div>\n<p><strong>WPBoat<\/strong> is an incredible WordPress theme that suits people running Yacht Rental services. You will\u00a0love to see the design and layout of this theme, as every element of the theme is outlined in such a fashion that it effectively helps out in showcasing your child care services.<\/p>\n<p>The theme consists of a various segment where you can display about different services you offer, brief about your history, post blogs and article, place stunning images of your work and many more things which will help you build a bang-up your website.<\/p>\n<p><img class=\"alignnone wp-image-1146 size-full\" src=\"https:\/\/www.kiathemes.com\/wp-content\/uploads\/2018\/05\/01_Home-Page-14.png\" alt=\"\" width=\"590\" height=\"300\" \/><\/p>\n<h4>Astonishing features of WPBoat are \u2013<\/h4>\n<ul>\n<li>1-Click demo installation<\/li>\n<li>WordPress Live Customizer<\/li>\n<li>Powerful Admin Panel<\/li>\n<li>Visual Composer (Page Builder)<\/li>\n<li>Fully Responsive<\/li>\n<li>Multiple Headers<\/li>\n<li>Multiple Homepages<\/li>\n<li>Font Awesome icons<\/li>\n<li>Bootstrap components compatible<\/li>\n<li>Google Fonts Support<\/li>\n<li>SEO Friendly<\/li>\n<li>WPML Compatible<\/li>\n<li>Theme settings backup import\/export<\/li>\n<li>Demo content included<\/li>\n<li>Frequent updates<\/li>\n<li>Very Clearly Documentation (Step by Step)<\/li>\n<li>Fast Support<\/li>\n<li>Unlimited Colors<\/li>\n<li>Google Fonts<\/li>\n<li>Beautiful blog page with Sidebars<\/li>\n<li>Services Pages with Sidebars<\/li>\n<li>6 Month Free Support<\/li>\n<li><\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.kiathemes.com\/wpboat_demo\/\">Live Demo<\/a>\u00a0\u00a0<a href=\"https:\/\/www.kiathemes.com\/product\/wpboat-boat-yacht-rental-wordpress-theme\/\">Theme Info + Download<\/a><\/p>\n<div id=\":dz8.hw\" class=\"fkp8p\">\n<div id=\":e05.mw\" class=\"tk TmwRj Sn GjkoZd\">\n<div id=\":e05.ma\" class=\"Tn\">\n<div class=\"KL\">\n<div class=\"PD IF\">\n<div id=\":e05.co\" class=\"JL\">\n<div class=\"Mu SP\">\n<h2><strong>CareBaby \u2013 Child Care WordPress Theme<\/strong><\/h2>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Carebaby is an incredible WordPress theme that suits for people running child care services like Kindergarten, Pre-school, Babysitter services and child care services. You will\u00a0love to see the design and layout of this theme, as every element of the theme is outlined in such a fashion that it effectively helps out in showcasing your child care services.<\/p>\n<p>The theme consists of a various segment where you can display about different services you offer, brief about your history, post blogs and article, place stunning images of your work and many more things which will help you build a bang-up your website.<\/p>\n<p><img class=\"alignnone wp-image-1117 size-full\" src=\"https:\/\/www.kiathemes.com\/wp-content\/uploads\/2018\/05\/01_Home-Page-13.png\" alt=\"\" width=\"590\" height=\"300\" \/><\/p>\n<h4>Astonishing features of Carebaby are \u2013<\/h4>\n<ul>\n<li>Full-screen image slider which comes with parallax phenomenon.<\/li>\n<li>Multiple color options to choose from.<\/li>\n<li>Contact Us page comes integrated with Google Maps<\/li>\n<li>Responsive layout of the theme makes it accessible through any viewing device.<\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.kiathemes.com\/carebaby_demo\/\">Live Demo<\/a>\u00a0\u00a0<a href=\"https:\/\/www.kiathemes.com\/product\/carebaby-children-kindergarten-wp-theme\/\">Theme Info + Download<\/a><\/p>\n",
            "excerpt": "<p>Nancy – Blog\/Magzine WordPress Theme &nbsp; Nancy\u00a0is\u00a0a\u00a0multi-purpose blog WordPress theme for Charity blogging business.\u00a0Nancy\u00a0has many useful features, its simple and easy to use, modern and creative, user-friendly, responsive design WordPress theme. Main Features. Fully Responsive Multiple Headers Multiple Layouts Post Formats Gallery Posts Video Posts image Posts Music Posts Unlimited color options One Click Demo [&hellip;]<\/p>\n",
            "slug": "free-website-themes-for-wordpress-kia-themes",
            "guid": "https:\/\/bestdirectorywordpressthemes.wordpress.com\/?p=28",
            "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": false,
            "is_reblogged": false,
            "is_following": false,
            "global_ID": "b55beb59040eace08a9ad74fed9a2058",
            "featured_image": "",
            "post_thumbnail": null,
            "format": "standard",
            "geo": false,
            "menu_order": 0,
            "publicize_URLs": [],
            "tags": {},
            "categories": {
                "WordPress": {
                    "ID": 33,
                    "name": "WordPress",
                    "slug": "wordpress",
                    "description": "",
                    "post_count": 7,
                    "feed_url": "https:\/\/bestdirectorywordpressthemes.wordpress.com\/category\/wordpress\/feed\/",
                    "parent": 0,
                    "meta": {
                        "links": {
                            "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/categories\/slug:wordpress",
                            "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/categories\/slug:wordpress\/help",
                            "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589"
                        }
                    }
                }
            },
            "attachments": {},
            "metadata": false,
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/posts\/28",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/posts\/28\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/posts\/28\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/posts\/28\/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": "b55beb59040eace08a9ad74fed9a2058",
            "is_external": false,
            "site_name": "Kia Themes",
            "site_URL": "https:\/\/bestdirectorywordpressthemes.wordpress.com",
            "site_is_private": false,
            "featured_media": {}
        },
        {
            "ID": 26,
            "site_ID": 147820589,
            "author": {
                "ID": 140506783,
                "login": "kiathemesnew",
                "email": false,
                "name": "kiathemesnew",
                "first_name": "",
                "last_name": "",
                "nice_name": "kiathemesnew",
                "URL": "http:\/\/bestdirectorywordpressthemes.wordpress.com",
                "avatar_URL": "https:\/\/2.gravatar.com\/avatar\/e49ce9b19812231d7566c2f7001a009e?s=96&d=identicon&r=G",
                "profile_URL": "https:\/\/en.gravatar.com\/kiathemesnew",
                "ip_address": false,
                "site_ID": 147820589,
                "site_visible": true
            },
            "date": "2018-06-23T05:55:47+00:00",
            "modified": "2018-06-23T05:55:47+00:00",
            "title": "Basic wordpress theme Template – Kia Theme",
            "URL": "https:\/\/bestdirectorywordpressthemes.wordpress.com\/2018\/06\/23\/basic-wordpress-theme-template-kia-theme\/",
            "short_URL": "https:\/\/wp.me\/pa0eT3-q",
            "content": "<div class=\"Mu SP\">\n<h2><strong>WPBoat \u2013 Boat &amp; Yacht Rental WordPress Theme<\/strong><\/h2>\n<\/div>\n<p><strong>WPBoat<\/strong> is an incredible WordPress theme that suits people running Yacht Rental services. You will\u00a0love to see the design and layout of this theme, as every element of the theme is outlined in such a fashion that it effectively helps out in showcasing your child care services.<\/p>\n<p>The theme consists of a various segment where you can display about different services you offer, brief about your history, post blogs and article, place stunning images of your work and many more things which will help you build a bang-up your website.<\/p>\n<p><img class=\"alignnone wp-image-1146 size-full\" src=\"https:\/\/www.kiathemes.com\/wp-content\/uploads\/2018\/05\/01_Home-Page-14.png\" alt=\"\" width=\"590\" height=\"300\" \/><\/p>\n<h4>Astonishing features of WPBoat are \u2013<\/h4>\n<ul>\n<li>1-Click demo installation<\/li>\n<li>WordPress Live Customizer<\/li>\n<li>Powerful Admin Panel<\/li>\n<li>Visual Composer (Page Builder)<\/li>\n<li>Fully Responsive<\/li>\n<li>Multiple Headers<\/li>\n<li>Multiple Homepages<\/li>\n<li>Font Awesome icons<\/li>\n<li>Bootstrap components compatible<\/li>\n<li>Google Fonts Support<\/li>\n<li>SEO Friendly<\/li>\n<li>WPML Compatible<\/li>\n<li>Theme settings backup import\/export<\/li>\n<li>Demo content included<\/li>\n<li>Frequent updates<\/li>\n<li>Very Clearly Documentation (Step by Step)<\/li>\n<li>Fast Support<\/li>\n<li>Unlimited Colors<\/li>\n<li>Google Fonts<\/li>\n<li>Beautiful blog page with Sidebars<\/li>\n<li>Services Pages with Sidebars<\/li>\n<li>6 Month Free Support<\/li>\n<li><\/li>\n<\/ul>\n<p><a href=\"https:\/\/www.kiathemes.com\/wpboat_demo\/\">Live Demo<\/a>\u00a0\u00a0<a href=\"https:\/\/www.kiathemes.com\/product\/wpboat-boat-yacht-rental-wordpress-theme\/\">Theme Info + Download<\/a><\/p>\n",
            "excerpt": "<p>WPBoat \u2013 Boat &amp; Yacht Rental WordPress Theme WPBoat is an incredible WordPress theme that suits people running Yacht Rental services. You will\u00a0love to see the design and layout of this theme, as every element of the theme is outlined in such a fashion that it effectively helps out in showcasing your child care services. [&hellip;]<\/p>\n",
            "slug": "basic-wordpress-theme-template-kia-theme",
            "guid": "https:\/\/bestdirectorywordpressthemes.wordpress.com\/?p=26",
            "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": false,
            "is_reblogged": false,
            "is_following": false,
            "global_ID": "d456c9882ce20f56c348257528c1e0bd",
            "featured_image": "",
            "post_thumbnail": null,
            "format": "standard",
            "geo": false,
            "menu_order": 0,
            "publicize_URLs": [],
            "tags": {},
            "categories": {
                "WordPress": {
                    "ID": 33,
                    "name": "WordPress",
                    "slug": "wordpress",
                    "description": "",
                    "post_count": 7,
                    "feed_url": "https:\/\/bestdirectorywordpressthemes.wordpress.com\/category\/wordpress\/feed\/",
                    "parent": 0,
                    "meta": {
                        "links": {
                            "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/categories\/slug:wordpress",
                            "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/categories\/slug:wordpress\/help",
                            "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589"
                        }
                    }
                }
            },
            "attachments": {},
            "metadata": false,
            "meta": {
                "links": {
                    "self": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/posts\/26",
                    "help": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/posts\/26\/help",
                    "site": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589",
                    "replies": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/posts\/26\/replies\/",
                    "likes": "https:\/\/public-api.wordpress.com\/rest\/v1\/sites\/147820589\/posts\/26\/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": "d456c9882ce20f56c348257528c1e0bd",
            "is_external": false,
            "site_name": "Kia Themes",
            "site_URL": "https:\/\/bestdirectorywordpressthemes.wordpress.com",
            "site_is_private": false,
            "featured_media": {}
        }
    ]
}