[wp-trac] [WordPress Trac] #50387: Cannot modify header information - headers already sent for "nocache_headers()"

WordPress Trac noreply at wordpress.org
Sun Jun 14 10:31:48 UTC 2020


#50387: Cannot modify header information - headers already sent for
"nocache_headers()"
--------------------------+------------------------------
 Reporter:  malthert      |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by williampatton):

 Hi @malthert,

 Thank you for opening this ticket and sorry you ran into a problem here.

 The `nocache_headers()` function actually does already contain an early
 bail the same as your suggested change. See:
 https://developer.wordpress.org/reference/functions/nocache_headers/#source

 Is there something else wrong with the function that you think could be
 improved? Is your suggestion only about returning false?

 If we are changing the returns in the function personally I would prefer a
 descriptive `WP_Error` object be returned so it could proved feedback
 about what is going wrong.

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


More information about the wp-trac mailing list