#59891 closed defect (bug) (fixed)
Incorrect example for WP_HTML_Tag_Processor class
Reported by: | atachibana | Owned by: | Bernhard Reiter |
---|---|---|---|
Milestone: | 6.4.2 | Priority: | normal |
Severity: | minor | Version: | 6.4 |
Component: | HTML API | Keywords: | has-patch fixed-major |
Focuses: | docs | Cc: |
Description (last modified by )
This issue was originally reported as https://github.com/WordPress/Documentation-Issue-Tracker/issues/1362.
The examples in the documentation reference:
https://developer.wordpress.org/reference/classes/wp_html_tag_processor/#modifying-html-attributes-for-a-found-tag
using the class parameter to query for an existing class on a tag. But the source code and code function documentation actually only support the class_name
property:
The example under Modifying HTML attributes for a found tag should be:
if ( $tags->next_tag( array( 'class_name' => 'wp-group-block' ) ) ) {
At least for me in WP 6.3.
Reported by @gaambo via User Contributed Notes.
Change History (10)
This ticket was mentioned in PR #5661 on WordPress/wordpress-develop by @dmsnell.
10 months ago
#2
- Keywords has-patch added
#3
@
10 months ago
- Milestone changed from Awaiting Review to 6.5
- Owner set to audrasjb
- Status changed from new to accepted
Thanks for the report and PR. Self assigning for commit consideration.
#4
@
10 months ago
- Owner changed from audrasjb to Bernhard Reiter
Since this has been sitting for a while and I'm committing a few things right now anyway, I'm taking this over. Hope that's okay @audrasjb -- otherwise kindly let me know if I'm overstepping :)
@Bernhard Reiter commented on PR #5661:
10 months ago
#6
Committed to Core in https://core.trac.wordpress.org/changeset/57116.
#7
@
10 months ago
- Keywords fixed-major added
- Milestone changed from 6.5 to 6.4.2
- Resolution fixed deleted
- Status changed from closed to reopened
Reopening for backporting to the 6.4 branch.
This is a (minor) doc fix that seems to make sense to have in 6.4.x, as it might otherwise continue to throw people off while they're using the HTML API (potentially causing them to re-report the issue).
@Bernhard Reiter commented on PR #5661:
10 months ago
#9
Backported to Core's 6.4 branch in https://core.trac.wordpress.org/changeset/57117.
Trac ticket: Core-59891
Resolves: https://github.com/WordPress/Documentation-Issue-Tracker/issues/1362
The example code in the PHPDoc comment for the HTML Tag Processor class previously showed calling
next_tag()
with an array containing aclass
key, which should have beenclass_name
. This patch fixes this by using the appropriateclass_name
key.Props: @gaambo, @crstauf, @atachibana
As a documentation change this should have no impact on any code and should need no testing.