Placeholders Edit

Highlight: Enclose placeholders in a <var> element and use uppercase characters with underscore delimiters.

Placeholders in code and commands represent values that the user must input or replace. Placeholders in outputs can also represent values that differ. Generally, placeholders have a descriptive name and a value.

For example, POST_ID represents a post ID in a code example, command, and example output. In example output, VERSION represents the version of a plugin, theme, or software; the reader is not expected to set this to a specific value.

This page explains how to format placeholder variables in commands and code examples. For more information about other code-related documentation, see Code in text, Code examples, and Command-line syntax.

Placeholder variables

Top ↑

Placeholder variables in inline text

When placeholder variables appear in a sentence, use the following formatting:

  • In HTML, enclose inline placeholders in <code><var> elements.

html
<code>PLACEHOLDER_VARIABLE</code>

  • In Markdown, enclose inline placeholders in backticks (`) and use an asterisk (*) before the first and second backtick.

markdown
*`PLACEHOLDER_VARIABLE`*

Top ↑

Placeholder variables in code blocks

When placeholder variables are in a block of code, use the following formatting:

{% codetabs %}
{% HTML %}

Enclose the code block in a <pre> element and tag placeholders with <var> elements.

&lt;pre class=&quot;prototype&quot;>
&lt;img
  src=&quot;&lt;var>IMAGE_PATH&lt;/var>&quot;
  alt=&quot;&lt;var>ALT_TEXT&lt;/var>&quot;
/>
&lt;/pre>

{% Markdown %}

Enclose the code block in a code fence. You cannot apply text formatting or highlighting such as bold or italic inside a code fence.

“`
*PLACEHOLDER_VARIABLE*
“`

{% end %}

Top ↑

Placeholder variable text

For text in placeholder variables, use uppercase characters with underscore delimiters. If using uppercase characters with underscore delimiters, or capitalizing lowercase characters with already uppercase characters seems inconsistent, then it is acceptable to use another convention; but be consistent with that convention.

Examples

{% codetabs %}
{% HTML %}

Not recommended:
https://developer.wordpress.org/<var>API-name</var>
https://developer.wordpress.org/<var>API_name</var>
https://developer.wordpress.org/<var>API name</var>
https://developer.wordpress.org/<var>api_name</var>
https://developer.wordpress.org/<var>api-name</var>
https://developer.wordpress.org/<var>apiName</var>


Recommended:
https://developers.google.com/<var>API_NAME</var>
https://developers.google.com/<var>POST_TITLE</var>


{% Markdown %}

Not recommended:
https://developer.wordpress.org/*API-name*`
-
https://developer.wordpress.org/*API name*-https://developer.wordpress.org/*API_name*`
https://developer.wordpress.org/*api_name*`
-
https://developer.wordpress.org/*api-name*`
– `https://developer.wordpress.org/*apiName*`


Recommended:
https://developers.google.com/*API_NAME*`
-
https://developers.google.com/*POST_TITLE*`


{% end %}

Don’t use possessive pronouns in placeholder variables.

Examples
{% codetabs %}
{% HTML %}

Not recommended:
https://developer.wordpress.org/<var>MY_API_NAME</var>
https://developer.wordpress.org/<var>YOUR_API_NAME</var>

{% Markdown %}

Not recommended:
https://developer.wordpress.org/*MY_API_NAME*`
-
https://developer.wordpress.org/*YOUR_API_NAME*`


{% end %}

For more information about placeholder text in commands, see Optional arguments, Mutually exclusive arguments, and Multiple value arguments.

Top ↑

Describing placeholders

When you use a placeholder in code examples, commands, or other text, include an explanation for what the placeholder represents. Write an explanation for the first time you use the placeholder; if there are multiple placeholders or steps after the first use of that placeholder, you can explain the placeholder again.

Use the following order to describe placeholders:
– Describe what the user is doing.
– Write the code example, command, or other text.
– Explain the placeholder.
– Explain the code example, command, or other text in more detail if required.
– Show any output if required.
– Explain any output if required.

Example

Recommended:

<br />
&lt;pre class=&quot;prototype&quot;><br />
&lt;img<br />
  src=&quot;&lt;var>IMAGE_PATH&lt;/var>&quot;<br />
  alt=&quot;The WordPress mascot Wapuu.&quot;<br />
/><br />
&lt;/pre></p>
<p>&lt;p>Replace the following:&lt;/p></p>
<p>&lt;ul><br />
  &lt;li>&lt;code><var>IMAGE_PATH</var>&lt;/code>: the directory path of the image asset.&lt;/li><br />
&lt;/ul><br />

Top ↑

Single placeholder

When writing a single placeholder, replace PLACEHOLDER with a description of what the placeholder represents.

Example

Recommended:
To delete an existing post, enter the following command:

$ wp post delete POST_ID

Replace POST_ID with the ID of the post that you want to delete.

Top ↑

Multiple placeholders

When there are two or more placeholders in code examples, commands, or other text, use the following formatting:
– Write a descriptive list of all the placeholder variables used in the respective code example, command, or other text, after the code content.
– Explain what each placeholder variable represents.
– Introduce the placeholder description list with Replace the following:
– List all the placeholder variables in the order in which they appear in the code example, command, or other text.
– Provide a description for each placeholder variable.
– Tag each placeholder with <code><var> elements, followed by a colon and lowercase letter as follows:
html
<li><code>PLACEHOLDER</code>: description</li>

Example

Recommended:
To edit an existing post, enter the following command:

$ wp post edit POST_ID --path=PATH --skip-themes[=THEMES]

Replace the following:
POST_ID: the ID of the post that you want to edit.
PATH: the path to the WordPress files.
THEMES: skip loading all themes, or a comma-separated list of themes.

Top ↑

Placeholders in output

When you specify placeholders in output examples, use the following formatting:
– Write a descriptive list of all the placeholder variables used in the output, after the output example.
– Introduce the placeholder description list with In this output:
– List all the placeholder variables in the order in which they appear in the output example.
– Provide a description for each placeholder variable.
– Tag each placeholder with <code><var> elements, followed by a colon and lowercase letter as follows:
html
<li><code>PLACEHOLDER</code>: description</li>

For more information, see Command output.

Example

Recommended:
The output is similar to the following:

{
    "name": "SITE_NAME",
    "description": "SITE_DESCRIPTION",
    "routes": { ... },
    "authentication": {
        "oauth1": {
            "request": "OAUTH_REQUEST_URL",
            "authorize": "OAUTH_AUTHORIZE_URL",
            "access": "http://example.com/oauth/access",
            "version": "0.1"
        }
    }
}

In this output:

  • SITE_NAME: the name of the site.
  • SITE_DESCRIPTION: the description of the site.
  • OAUTH_REQUEST_URL: the OAuth requesting URLURL A specific web address of a website or web page on the Internet, such as a website’s URL www.wordpress.org.
  • OAUTH_AUTHORIZE_URL: the OAuth authorizing URL.

Last updated: