Properties

$date_range

$date_range

$response_format

$response_format

$post_object_format

$post_object_format

$api

$api

$pass_wpcom_user_details

$pass_wpcom_user_details

$can_use_user_details_instead_of_blog_membership

$can_use_user_details_instead_of_blog_membership

$description

$description

$group

$group

$stat

$stat

$method

$method

$path

$path

$path_labels

$path_labels

$query

$query

$request_format

$request_format

$in_testing

$in_testing

$version

$version : string

Type

string — Version of the API

$example_request

$example_request : string

Type

string — Example request to make

$example_request_data

$example_request_data : string

Type

string — Example request data (for POST methods)

$example_response

$example_response : string

Type

string — Example response from $example_request

Methods

callback()

callback( $path) : \falsy:

Return endpoint response

Parameters

$path

Returns

\falsy: —

HTTP 500, no response body WP_Error( $error_code, $error_message, $http_status_code ): HTTP $status_code, json_encode( array( 'error' => $error_code, 'message' => $error_message ) ) response body $data: HTTP 200, json_encode( $data ) response body

handle_date_range()

handle_date_range( $where)

Parameters

$where

__construct()

__construct( $args)

Parameters

$args

is_post_type_allowed()

is_post_type_allowed( $post_type)

Parameters

$post_type

is_metadata_public()

is_metadata_public( $key)

Parameters

$key

the_password_form()

the_password_form()

get_post_by()

get_post_by( $field,  $post_id,  $context)

Parameters

$field
$post_id
$context

get_the_post_content_for_display()

get_the_post_content_for_display()

get_blog_post()

get_blog_post( $blog_id,  $post_id,  $context)

Parameters

$blog_id
$post_id
$context

find_featured_media()

find_featured_media(\WP_Post $post) : object

Supporting featured media in post endpoints. Currently on for wpcom blogs since it's calling WPCOM_JSON_API_Read_Endpoint methods which presently rely on wpcom specific functionality.

Parameters

\WP_Post $post

Returns

object —

list of featured media

win8_gallery_shortcode()

win8_gallery_shortcode( $attr)

Parameters

$attr

get_attachment()

get_attachment(mixed $attachment) : \(object)

Returns attachment object.

Parameters

mixed $attachment

attachment row

Returns

\(object)

query_args()

query_args( $return_default_values,  $cast_and_filter)

Parameters

$return_default_values
$cast_and_filter

input()

input( $return_default_values,  $cast_and_filter)

Parameters

$return_default_values
$cast_and_filter

cast_and_filter()

cast_and_filter( $data,  $documentation,  $return_default_values,  $for_output)

Parameters

$data
$documentation
$return_default_values
$for_output

cast_and_filter_item()

cast_and_filter_item( $return,  $type,  $key,  $value,  $types,  $for_output)

Casts $value according to $type.

Handles fallbacks for certain values of $type when $value is not that $type Currently, only handles fallback between string <-> array (two way), from string -> false (one way), and from object -> false (one way)

Handles "child types" - array:URL, object:category array:URL means an array of URLs object:category means a hash of categories

Handles object typing - object>post means an object of type post

Parameters

$return
$type
$key
$value
$types
$for_output

parse_types()

parse_types( $text)

Parameters

$text

document()

document( $show_description)

Auto generates documentation based on description, method, path, path_labels, and query parameters.

Echoes HTML.

Parameters

$show_description

add_http_build_query_to_php_content_example()

add_http_build_query_to_php_content_example( $matches)

Parameters

$matches

generate_doc_description()

generate_doc_description( $item)

Recursively generates the <dl>'s to document item descriptions.

Echoes HTML.

Parameters

$item

generate_documentation()

generate_documentation()

Auto generates documentation based on description, method, path, path_labels, and query parameters.

Echoes HTML.

user_can_view_post()

user_can_view_post( $post_id)

Parameters

$post_id

get_author()

get_author(mixed $author, mixed $show_email) : \(object)

Returns author object.

Parameters

mixed $author

user ID, user row, WP_User object, comment row, post row

mixed $show_email

output the author's email address?

Returns

\(object)

get_taxonomy()

get_taxonomy( $taxonomy_id,  $taxonomy_type,  $context)

Parameters

$taxonomy_id
$taxonomy_type
$context

format_date()

format_date(mixed $date_gmt, mixed $date) : string

Returns ISO 8601 formatted datetime: 2011-12-08T01:15:36-08:00

Parameters

mixed $date_gmt

(string) GMT datetime string.

mixed $date

(string) Optional. Used to calculate the offset from GMT.

Returns

string

parse_date()

parse_date( $date_string) : \array(

Parses a date string and returns the local and GMT representations of that date & time in 'YYYY-MM-DD HH:MM:SS' format without timezones or offsets. If the parsed datetime was not localized to a particular timezone or offset we will assume it was given in GMT relative to now and will convert it to local time using either the timezone set in the options table for the blog or the GMT offset.

Parameters

$date_string

Returns

\array( —

$local_time_string, $gmt_time_string )

get_link()

get_link()

get_me_link()

get_me_link( $path)

Parameters

$path

get_taxonomy_link()

get_taxonomy_link( $blog_id,  $taxonomy_id,  $taxonomy_type,  $path)

Parameters

$blog_id
$taxonomy_id
$taxonomy_type
$path

get_site_link()

get_site_link( $blog_id,  $path)

Parameters

$blog_id
$path

get_post_link()

get_post_link( $blog_id,  $post_id,  $path)

Parameters

$blog_id
$post_id
$path

get_comment_link()

get_comment_link( $blog_id,  $comment_id,  $path)

Parameters

$blog_id
$comment_id
$path