[wp-trac] [WordPress Trac] #43116: wp_footer actions being applied to output when the Content-Type header is set to "application/pdf"

WordPress Trac noreply at wordpress.org
Wed Jan 17 21:08:11 UTC 2018


#43116: wp_footer actions being applied to output when the Content-Type header is
set to "application/pdf"
--------------------------+------------------------------
 Reporter:  jdgregson     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  4.9.2
 Severity:  normal        |  Resolution:
 Keywords:  close         |     Focuses:
--------------------------+------------------------------
Changes (by swissspidy):

 * keywords:   => close


Comment:

 Hey there,

 Welcome to WordPress Trac!

 How exactly are you creating that PDF download?

 WordPress doesn't execute the `wp_footer` call simply because it sees
 `</body>` somewhere. That hook is only called when a theme calls
 `wp_footer()` in their template.

 Thus, when you return some special content like a PDF with a different
 content type., you need to bypass the regular theme output by using
 filters like `template_include` or by using `die()` to stop further
 output.

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


More information about the wp-trac mailing list