WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/force balance tags

Description

Balances tags of string using a modified stack.

Ignores the 'use_balanceTags' option.

Usage

<?php force_balance_tags$text ?>

This function is used in the short post excerpt list, to prevent unmatched elements. For example, it makes <div><b>This is an excerpt. <!--more--> and this is more text... </b></div> not break, when the html after the more tag is cut off.

Parameters

$text
(string) (required) Text to be balanced.
Default: None

Return Values

(string) 
Balanced text.

Examples

In the example above, <div><b>This is an excerpt.  should be changed to: <div><b>This is an excerpt. </b></div> by the force_balance_tags function.

Notes

Change Log

Since: 2.0.4

Source File

force_balance_tags() is located in wp-includes/formatting.php.

Related

See also index of Function Reference and index of Template Tags.