[wp-trac] [WordPress Trac] #62738: Proposal for format_atts()
WordPress Trac
noreply at wordpress.org
Thu Dec 26 16:04:35 UTC 2024
#62738: Proposal for format_atts()
--------------------------+------------------------------
Reporter: takayukister | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Formatting | Version:
Severity: normal | Resolution:
Keywords: | Focuses:
--------------------------+------------------------------
Comment (by dmsnell):
@takayukister note also that this kind of work is ongoing with the HTML
API and it’s planned to have HTMP templating: see #60229 and #50867.
In the meantime you can already use the HTML API to this effect.
{{{#!php
<?php
$input = new WP_HTML_Tag_Processor( “<input>” );
$input->next_tag();
$input->set_attribute( “type”, “checked” );
$input->set_attribute( “checked”, true );
…
return $input->get_updated_html();
}}}
A benefit to using the HTML API is that you will get fully well-formed
HTML, unlike in the previous example which includes a few examples of
outdated norms for HTML.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/62738#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list