GET /sites/$site/shortcodes/render

Get a rendered shortcode for a site. Note: The current user must have publishing access.

Resource Information

Method GET
Requires authentication? Yes

Method Parameters

Parameter Type Description
$site (int|string) Site ID or domain

Query Parameters

Parameter Type Description
context (string)
(default) Formats the output as HTML for display. Shortcodes are parsed, paragraph tags are added, etc..
Formats the output for editing. Shortcodes are left unparsed, significant whitespace is kept, etc..
http_envelope (bool)
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)
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.
shortcode (string) The query-string encoded shortcode string to render. Required. Only accepts one at a time.

Response Parameters

Parameter Type Description
shortcode (string) The shortcode that was passed in for rendering.
result (html) The rendered HTML result of the shortcode.
scripts (array) An array of JavaScript files needed to render the shortcode. Returned in the format of { "script-slug" : { "src": "", "extra" : "" } } where extra contains any neccessary extra JS for initializing the source file and src contains the script to load. Omitted if no scripts are neccessary.
styles (array) An array of CSS files needed to render the shortcode. Returned in the format of { "style-slug" : { "src": "", "media" : "all" } }. Omitted if no styles are neccessary.

Resource Errors

These are the possible errors returned by this endpoint.

HTTP Code Error Identifier Error Message
403 unauthorized User cannot access this private blog.
403 unauthorized User cannot access this restricted blog
400 invalid_shortcode Only one shortcode can be rendered at a time.
400 invalid_shortcode The requested shortcode does not exist.
400 invalid_shortcode The shortcode parameter must begin and end with square brackets.
403 unauthorized Your token must have permission to post on this blog.


curl \
 -H 'authorization: Bearer YOUR_API_TOKEN' \
$options  = array (
  'http' => 
  array (
    'ignore_errors' => true,
    'header' => 
    array (
      0 => 'authorization: Bearer YOUR_API_TOKEN',

$context  = stream_context_create( $options );
$response = file_get_contents(
$response = json_decode( $response );


    "shortcode": "",
    "result": "",
    "scripts": {
        "jetpack-carousel": {
            "src": "https:\/\/\/wp-content\/mu-plugins\/jetpack-plugin\/sun\/_inc\/build\/carousel\/jetpack-carousel.min.js?ver=12.7-a.0",
            "extra": "var jetpackSwiperLibraryPath = {\"url\":\"https:\\\/\\\/\\\/wp-content\\\/mu-plugins\\\/jetpack-plugin\\\/sun\\\/_inc\\\/build\\\/carousel\\\/swiper-bundle.min.js\"};\nvar jetpackCarouselStrings = {\"widths\":[370,700,1000,1200,1400,2000],\"is_logged_in\":\"1\",\"lang\":\"en\",\"ajaxurl\":\"https:\\\/\\\/\\\/wp-admin\\\/admin-ajax.php\",\"nonce\":\"d4b82842e0\",\"display_exif\":\"1\",\"display_comments\":\"1\",\"single_image_gallery\":\"1\",\"single_image_gallery_media_file\":\"\",\"background_color\":\"black\",\"comment\":\"Comment\",\"post_comment\":\"Post Comment\",\"write_comment\":\"Write a Comment...\",\"loading_comments\":\"Loading Comments...\",\"download_original\":\"View full size <span class=\\\"photo-size\\\">{0}<span class=\\\"photo-size-times\\\">\\u00d7<\\\/span>{1}<\\\/span>\",\"no_comment_text\":\"Please be sure to submit some text with your comment.\",\"no_comment_email\":\"Please provide an email address to comment.\",\"no_comment_author\":\"Please provide your name to comment.\",\"comment_post_error\":\"Sorry, but there was an error posting your comment. Please try again later.\",\"comment_approved\":\"Your comment was approved.\",\"comment_unapproved\":\"Your comment is in moderation.\",\"camera\":\"Camera\",\"aperture\":\"Aperture\",\"shutter_speed\":\"Shutter Speed\",\"focal_length\":\"Focal Length\",\"copyright\":\"Copyright\",\"comment_registration\":\"0\",\"require_name_email\":\"1\",\"login_url\":\"https:\\\/\\\/\\\/wp-login.php\",\"blog_id\":\"82974409\",\"meta_data\":[\"camera\",\"aperture\",\"shutter_speed\",\"focal_length\",\"copyright\"],\"stats_query_args\":\"blog=5836086&v=wpcom&tz=0&user=1&user_id=78972699&subd=public-api\",\"is_public\":\"1\"};"
        "carousel-wpcom": {
            "src": "https:\/\/\/wp-content\/mu-plugins\/carousel-wpcom\/carousel-wpcom.js?ver=20210511"
    "styles": {
        "jetpack-carousel-swiper-css": {
            "src": "https:\/\/\/wp-content\/mu-plugins\/jetpack-plugin\/sun\/modules\/carousel\/swiper-bundle.css?m=1685115060i&ver=12.7-a.0",
            "media": "all"
        "jetpack-carousel": {
            "src": "https:\/\/\/wp-content\/mu-plugins\/jetpack-plugin\/sun\/modules\/carousel\/jetpack-carousel.css?m=1685115060i&ver=12.7-a.0",
            "media": "all"