Modify opening and closing HTML tag. Also works for self-closed markup.

This function will automatically modify the opening and the closing HTML tag. If the markup is self-closed, the HTML tag will be modified accordingly.

The “data-markup-id” is added as a HTML attribute if the development mode is enabled. This makes it very easy to find the content ID when inspecting an element in a web browser.

beans_modify_markup( string $id, string|callback $markup, int $priority = 10, int $args = 1 )

Return: (bool) Will always return true.


$idstringtrue-The markup ID.
$markupstring|callbacktrue-The replacment HTML tag. A callback is accepted if conditions needs to be applied. If arguments are available, they are passed to the callback.
$priorityintfalse10Used to specify the order in which the functions associated with a particular action are executed. Default 10. Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order in which they were added to the action.
$argsintfalse1The number of arguments the function accepts. Default 1.


function beans_modify_markup( $id, $markup, $priority = 10, $args = 1 ) {

	return beans_add_filter( $id . '_markup', $markup, $priority, $args );