Make WordPress Core

Opened 5 months ago

Closed 4 months ago

#64317 closed defect (bug) (fixed)

Docs: Update the comment of the `wp_enqueue_classic_theme_styles()` function

Reported by: wildworks's profile wildworks Owned by: westonruter's profile westonruter
Milestone: 7.0 Priority: normal
Severity: normal Version: 6.4
Component: Themes Keywords: good-first-bug has-patch
Focuses: Cc:

Description

Related to #61892

The wp_enqueue_classic_theme_styles() function is executed on both the editor and the front-end:

Therefore, the following function comment is misleading:

"Loads classic theme styles on classic themes in the frontend."

We should remove the "in the frontend." fron the comment.

Attachments (1)

64317.diff (459 bytes) - added by iflairwebtechnologies 5 months ago.
Patch updates incorrect docblock description

Download all attachments as: .zip

Change History (9)

@iflairwebtechnologies
5 months ago

Patch updates incorrect docblock description

#1 @iflairwebtechnologies
5 months ago

  • Keywords has-patch added
  • Version set to trunk

Updates docblock to remove incorrect “in the frontend” reference.

This ticket was mentioned in PR #10565 on WordPress/wordpress-develop by @manhphucofficial.


5 months ago
#2

This PR updates the docblock for wp_enqueue_classic_theme_styles() to remove
the incorrect “in the frontend” phrase.

The function is executed on both the editor and the front end.

#4 @sabernhardt
4 months ago

  • Version changed from trunk to 6.4

When "in the frontend" was added in r54687, there were separate functions for front end and editor, but the editor started adding the stylesheet in the iframe as early as 6.4. (And 6.8 deprecated the editor function in r59980.)

#5 @westonruter
4 months ago

  • Milestone changed from Awaiting Review to 7.0
  • Owner set to westonruter
  • Status changed from new to reviewing

I think the description might be further improved.

In r54687 the function changed so that it only enqueued in non-block themes. That is, it enqueued in classic and hybrid themes. Now, however, it's enqueueing only in themes that lack a theme.json, which would be exclusively classic non-hybrid themes. It uses wp_theme_has_theme_json() which “Checks whether a theme or its parent has a theme.json file.” Since the definition of "classic theme" often encompases hybrid themes, I think this can be more explicit. So instead of:

Loads classic theme styles on classic themes.

I think it should rather be:

Loads classic theme styles in themes which lack a theme.json file.

@manhphucofficial commented on PR #10565:


4 months ago
#6

Suggested change applied. Let me know if anything else is needed.

@manhphucofficial commented on PR #10565:


4 months ago
#7

Suggested change applied. Thanks for the clarification!

#8 @westonruter
4 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 61322:

Docs: Improve accuracy of wp_enqueue_classic_theme_styles() description.

Developed in https://github.com/WordPress/wordpress-develop/pull/10565

Follow-up to [59980], [54687], [54358].

Props manhphucofficial, wildworks, sabernhardt, iflairwebtechnologies, westonruter.
See #61892, #64224.
Fixes #64317.

Note: See TracTickets for help on using tickets.