Properties

$comment_object_format

$comment_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

$response_format

$response_format

$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

__construct()

__construct( $args)

Parameters

$args

get_comment()

get_comment( $comment_id,  $context)

Parameters

$comment_id
$context

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