[wp-trac] [WordPress Trac] #10275: Filter logic has been put into the template loader while it not belongs there.

WordPress Trac noreply at wordpress.org
Sun Oct 20 00:51:12 UTC 2024


#10275: Filter logic has been put into the template loader while it not belongs
there.
-------------------------------------+-----------------------
 Reporter:  hakre                    |       Owner:  (none)
     Type:  defect (bug)             |      Status:  reopened
 Priority:  normal                   |   Milestone:  6.7
Component:  Themes                   |     Version:  2.8
 Severity:  normal                   |  Resolution:
 Keywords:  has-patch needs-testing  |     Focuses:  template
-------------------------------------+-----------------------

Comment (by sppramodh):

 == Test Report
 This report validates that the changes in the patch do not introduce any
 issues and work as intended.

 Patch tested: https://github.com/WordPress/wordpress-develop/pull/7321

 = Environments Tested

 === Environment 1
 - WordPress Playground
 - WordPress 6.7 (Patch applied)
 - PHP: 7.4.29
 - Browser: Google chrome 129.0.6668
 - Theme: Twenty Twenty-Four (Version 1.2)
 - Active Plugins:
   - [https://core.trac.wordpress.org/attachment/ticket/57913/57913-toggle-
 wp-attachment-pages-enabled.zip Toggle wp_attachment_pages_enabled]

 === Environment 2
 - WordPress Playground
 - PHP: 8.0
 - WordPress: 6.6.2
 - Browser: Google chrome 129.0.6668
 - Theme: Twenty Twenty-Four (Version 1.2)
 - Active Plugins:
   - [https://core.trac.wordpress.org/attachment/ticket/57913/57913-toggle-
 wp-attachment-pages-enabled.zip Toggle wp_attachment_pages_enabled]


 = Steps followed

 1 '''Enable Attachment Pages:'''
 Since attachment pages are fully disabled in WordPress 6.4 and later, the
 "Toggle wp_attachment_pages_enabled" plugin was used to enable attachment
 pages for testing.

 2 '''Media Upload:'''
 Uploaded an image to the Media Library.

 3 '''View Attachment Page:'''
 * On WordPress 6.6.2 (without the patch), the image was visible on the
 attachment page.
 * On WordPress 6.7 (with the patch applied), the image did not appear on
 the attachment page.

 screenshot from WordPress 6.7 patch applied

 [[Image(https://imgur.com/0EIYOXL)]]

 screenshot from WordPress 6.6.2

 [[Image(https://imgur.com/1RwiaxW)]]

 4 '''Behavior When Attachment Pages are Disabled (Default):'''
 There was no change in how the images were displayed when viewing media
 items.

 5 '''Custom Shortcode Testing:'''

     Created a custom shortcode that utilizes the the_content filter for
 compiling shortcodes.
     Developed a separate shortcode to display an attachment by ID.

 6 '''Testing Shortcodes on the Header:'''
 Added the custom shortcode and the attachment shortcode to the header,
 linking to a PDF (Download rates).

 screenshot from WordPress 6.7 patch applied

 [[Image(https://imgur.com/DtjpMTa)]]

 screenshot from WordPress 6.6.2

 [[Image(https://imgur.com/esCp8X7)]]

 [[Image(https://imgur.com/RqpVckj)]]


 7 '''Observations:'''
 * On WordPress 6.6.2, the attachment was automatically added to the
 header, appearing multiple times due to the the_content filter's effect
 when using shortcodes.
 * On WordPress 6.7 (with the patch), no such issue occurred on the
 attachment page. The attachment did not appear multiple times.

 8 '''Compatibility Testing with WooCommerce:'''
 Installed WooCommerce to verify if the shortcodes in the header caused any
 issues on WooCommerce pages.
 No problems were found with WooCommerce active.

 === Actual Results
 - ✅ Issue resolved with patch.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/10275#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list