apply_shortcodes() WordPress Function

The apply_shortcodes() function allows you to execute a shortcode in a string. This is useful when you want to programmatically generate content that includes shortcodes. The function accepts two parameters: the string containing the shortcode(s) to be executed, and an optional array of parameters to be passed to the shortcode(s).

apply_shortcodes( string $content, bool $ignore_html = false ) #

Search content for shortcodes and filter shortcodes through their hooks.


Description

This function is an alias for do_shortcode().

Top ↑

See also


Top ↑

Parameters

$content

(string)(Required)Content to search for shortcodes.

$ignore_html

(bool)(Optional)When true, shortcodes inside HTML elements will be skipped.

Default value: false


Top ↑

Return

(string) Content with shortcodes filtered out.


Top ↑

Source

File: wp-includes/shortcodes.php

function apply_shortcodes( $content, $ignore_html = false ) {
	return do_shortcode( $content, $ignore_html );
}


Top ↑

Changelog

Changelog
VersionDescription
5.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.