WP_HTML_Text_Replacement
- Since
- 6.2.0, 6.5.0
- Source
wp-includes/html-api/class-wp-html-text-replacement.php:22
Core class used by the HTML tag processor as a data structure for replacing existing content from start to end, allowing to drastically improve performance.
Description
This class is for internal usage of the WP_HTML_Tag_Processor class.
Compatibility
- WordPress
- since 6.5.0
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0).
Properties · 3
$startintpublic- Byte offset into document where replacement span begins.
$lengthintpublic- Byte length of span being replaced.
$textstringpublic- Span of text to insert in document to replace existing content from start to end.
Methods · 1
- __construct()Constructor.
Source code
class WP_HTML_Text_Replacement { /** * Byte offset into document where replacement span begins. * * @since 6.2.0 * * @var int */ public $start; /** * Byte length of span being replaced. * * @since 6.5.0 * * @var int */ public $length; /** * Span of text to insert in document to replace existing content from start to end. * * @since 6.2.0 * * @var string */ public $text; /** * Constructor. * * @since 6.2.0 * * @param int $start Byte offset into document where replacement span begins. * @param int $length Byte length of span in document being replaced. * @param string $text Span of text to insert in document to replace existing content from start to end. */ public function __construct( int $start, int $length, string $text ) { $this->start = $start; $this->length = $length; $this->text = $text; }}Changelog
Introduced in 6.2.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
6.5.0
Replace
end with length to more closely match substr().from the docblock6.2.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-includes/html-api/class-wp-html-text-replacement.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.