Skip to main content
Option - Dynamic Shortcodes

Explore the Option Dynamic Shortcode to fetch and display site options.

Updated over 6 months ago

The Option Dynamic Shortcode in WordPress enables the retrieval and display of various website options.

Syntax

{option:key}
  • key: The name of the site option to retrieve.

Note

The Option shortcode returns the raw option value. No formatting or escaping is applied.

Examples

  1. Basic Usage

    {option:siteurl}

    Retrieves the 'siteurl' option from WordPress settings.

  2. With Fallback Value:

    {option:nonexistent_option?https://fallbacksite.com}

    Attempts to fetch 'nonexistent_option'. If not found, defaults to 'https://fallbacksite.com'.

Special Privileges

For security reasons, only a whitelist of options can be accessed normally.

To access any option, you must use the Option Shortcode inside a Power Shortcode.
โ€‹

The following options can be accessed normally:

  • siteurl

  • home

  • blogname

  • blogdescription

  • start_of_week

  • posts_per_page

  • date_format

  • time_format

  • timezone_string

  • sticky_posts

  • www_user_roles

  • thumbnail_size_h

  • thumbnail_size_w

  • users_can_register

  • avatar_default

Did this answer your question?