Skip to content
Docs
Get RestroPress

Filter

{$shortcode}_shortcode_tag

Updated
On this page

Filters the tag under which a RestroPress shortcode is registered.

Runs once per shortcode while RP_Shortcodes::init() registers them, with the hook name built from the default tag. The shortcodes are fooditems, fooditem_cart, fooditem_checkout, rpress_receipt, fooditem_history, order_history, rpress_login, rpress_register, fooditem_discounts, rpress_profile_editor and customer_dashboard. Returning a different string registers the shortcode under that tag instead.

Parameters#

ParameterTypeDescription
$shortcodestringDefault shortcode tag.

Return value#

string. The tag to register the shortcode under.

Example#

function my_menu_shortcode_tag( $tag ) {
	return 'restaurant_menu';
}
add_filter( 'fooditems_shortcode_tag', 'my_menu_shortcode_tag' );

Notes#

Only the registered tag changes. Code that detects the default tag in post content with has_shortcode() (for example to load scripts) will not recognise the renamed tag, and existing content using the old tag stops rendering.

Source#

Applied in:

  • includes/class-rpress-shortcodes.php (line 49), in RP_Shortcodes::init()

See also#

Was this page helpful?