Directory

Incorrect example for `WP_HTML_Tag_Processor` class · Issue #1362 · WordPress/Documentation-Issue-Tracker · GitHub
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect example for WP_HTML_Tag_Processor class #1362

Closed
crstauf opened this issue Nov 11, 2023 · 3 comments
Closed

Incorrect example for WP_HTML_Tag_Processor class #1362

crstauf opened this issue Nov 11, 2023 · 3 comments
Assignees
Labels
[Status] Done Issue is completed

Comments

@crstauf
Copy link

crstauf commented Nov 11, 2023

Issue Description

The examples in the documentation reference using the class parameter to query for an existing class on a tag. But the source code and code function documentation actually only suppor 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.

URL of the Page with the Issue

https://developer.wordpress.org/reference/classes/wp_html_tag_processor/#modifying-html-attributes-for-a-found-tag

Section of Page with the issue

Usage > Modifying HTML attributes for a found tag

Why is this a problem?

Misrepresents how to use a method's class.

Suggested Fix

Change class to class_name.

@crstauf crstauf added the [Status] To do Issue marked as Todo label Nov 11, 2023
Copy link

Heads up @WordPress/docs-issues-coordinators, we have a new issue open. Time to use 'em labels.

@atachibana atachibana self-assigned this Nov 11, 2023
@github-actions github-actions bot added [Status] In progress Issue is in progress and removed [Status] To do Issue marked as Todo labels Nov 11, 2023
@atachibana
Copy link
Collaborator

@crstauf Thank you for the report.
To fix this issue, we need core ticket and its process. I opened a ticket as below and close this issue.
https://core.trac.wordpress.org/ticket/59891

@github-actions github-actions bot added [Status] Done Issue is completed and removed [Status] In progress Issue is in progress labels Nov 11, 2023
dmsnell added a commit to dmsnell/wordpress-develop that referenced this issue Nov 11, 2023
Trac ticket: Core-59891
Resolves: WordPress/Documentation-Issue-Tracker#1362

The example code in the PHPDoc comment for the HTML Tag Processor class
previously showed calling `next_tag()` with an array containing a `class`
key, which should have been `class_name`. This patch fixes this by using
the appropriate `class_name` key.

Props: @gaambo, @crstauf, @atachibana
@atachibana
Copy link
Collaborator

fyi
https://core.trac.wordpress.org/ticket/59891 was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Done Issue is completed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants