Make WordPress Core

Opened 6 years ago

Closed 4 years ago

Last modified 4 years ago

#13180 closed defect (bug) (invalid)

filter( 'the_content', 'prepend_attachment' ) on attachment pages may be problem

Reported by: thomask Owned by: azaozz
Milestone: Priority: lowest
Severity: minor Version: 3.0
Component: Widgets Keywords:
Focuses: Cc:


I'm not sure if this is a bug or feature: I have created widget where you can put text, and this text is then formated using apply_filters( 'the_content', $text )

it works great, and I think it is the right way, the only problem is on the attachment pages, where the widget text is automaticaly prepended by the attachment image.

the problem is
add_filter( 'the_content', 'prepend_attachment' );
filter on the_content, so it can be easily solved by
remove_filter( 'the_content', 'prepend_attachment' );

but i wonder, if it is not just workaround for a bug. IMHO the image is the content of the attachment page, not something which should be prepended by the_content filter.

Change History (3)

#1 @hakre
5 years ago

The filter the_content is reserved for post/page content only. It should not be applied to widgets.

Suggesting to close as wontfix.

#2 @scribu
4 years ago

  • Milestone Future Release deleted
  • Resolution set to invalid
  • Status changed from new to closed

Agree with hakre.

#3 @scribu
4 years ago

Other than that, prepend_attachment() is a dirty hack: #10275

Last edited 4 years ago by scribu (previous) (diff)
Note: See TracTickets for help on using tickets.