WP_HTML_Processor for replacing content inside tag
Opened this issue · 2 comments
I tried to find any example, but can't get it.
I would like to replace content in specific tag. I found only methods to replace attribute on tag but not content. Is it possible?
Not yet, but that is apparently part of the plan. From: https://make.wordpress.org/core/2023/10/21/updates-to-the-html-api-in-6-4/
In the future, it will be possible to insert and remove entire tags and to read and modify the inner markup inside a tag. In WordPress 6.4, however, the only new feature is the concept of breadcrumbs.
It’s on the HTML API roadmap and planned for WordPress 6.6:
Add functionality to the HTML API
set_inner_html()
See more in #57827.
@dmsnell, it would be helpful to provide more details in this issue and link back on the discussion with initial plans for WP 6.6.
Edit (from @dmsnell): Fixed the link to the discussion about the HTML API plans.