Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#28541 closed enhancement (fixed)

Remove duplicates in post_class/body_class

Reported by: Compute Owned by: SergeyBiryukov
Milestone: 4.0 Priority: normal
Severity: normal Version: 4.0
Component: Themes Keywords: has-patch commit
Focuses: template Cc:


With #18804 has-post-thumbnail has not been added. What if other plugins have already used this for a while? What if there is duplicate classes in multiple plugins?
While this does not break anything it's silly to have 2-3 of the same class in the same element.

Attachments (1)

28541.diff (892 bytes) - added by Compute 6 years ago.
array_unique( $classes ) before returning classes

Download all attachments as: .zip

Change History (3)

6 years ago

array_unique( $classes ) before returning classes

#1 @SergeyBiryukov
6 years ago

  • Keywords has-patch commit added
  • Milestone changed from Awaiting Review to 4.0

#2 @SergeyBiryukov
6 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 28760:

Prevent get_post_class() and get_body_class() from returning duplicate classes.

props Compute.
fixes #28541.

Note: See TracTickets for help on using tickets.