The query var Dynamic Shortcode allows you to retrieve different query variables within a page or post.
Syntax
{query_var:name}
name
: The name of the query variable you want to retrieve.
Examples
Basic Usage
{query_var:author}
Retrieves the author query variable. Useful for displaying the author of a post.Page ID Retrieval
{query_var:page_id}
Fetches the page ID. Ideal for use in templates where the page ID is needed for further processing or conditional content.Search Term:
{query_var:s}
Grabs the current search term. This is particularly handy for custom search results pages, allowing the display or use of the search term entered by the user.Category Name:
{query_var:category_name}
Gets the name of the current category.
Special Privileges
Access to certain query variables may require elevated privileges. In such cases, the shortcode must be used within a Power Shortcode to ensure proper access and functionality.