HTTP/2 200
server: nginx
date: Sat, 11 Oct 2025 18:00:12 GMT
content-type: text/html; charset=UTF-8
vary: Accept-Encoding
x-hacker: Want root? Visit join.a8c.com/hacker and mention this header.
host-header: WordPress.com
x-frame-options: SAMEORIGIN
vary: accept, content-type, cookie
content-encoding: gzip
x-ac: 1.bom _dca MISS
alt-svc: h3=":443"; ma=86400
strict-transport-security: max-age=31536000
server-timing: a8c-cdn, dc;desc=bom, cache;desc=MISS;dur=529.0
Like a post. – WordPress.com Developer Resources
Skip to content
Like a post.
Resource Information
Method
POST
URL
https://public-api.wordpress.com/rest/v1.1/sites/$site/posts/$post_ID/likes/new
Requires authentication?
Yes
Method Parameters
Parameter
Type
Description
$site
(int|string)
Site ID or domain
$post_ID
(int)
The post ID
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.
Response Parameters
Parameter
Type
Description
success
(bool)
Was the operation successful?
i_like
(bool)
Does the user like this post?
like_count
(int)
The number of likes for this post.
site_ID
(int)
The site ID
post_ID
(int)
The post ID
meta
(object)
Meta data
liker
(object)
The user involved
Resource Errors
This endpoint does not return any errors.
Example
curl \
-H 'authorization: Bearer YOUR_API_TOKEN' \
'https://public-api.wordpress.com/rest/v1/sites/example.wordpress.com/posts/1/likes/new/'
<?php
$options = array (
'http' =>
array (
'ignore_errors' => true,
'method' => 'POST',
'header' =>
array (
0 => 'authorization: Bearer YOUR_API_TOKEN',
),
),
);
$context = stream_context_create( $options );
$response = file_get_contents(
'https://public-api.wordpress.com/rest/v1/sites/example.wordpress.com/posts/1/likes/new/',
false,
$context
);
$response = json_decode( $response );
?>