[wp-trac] [WordPress Trac] #21876: unregister_default_headers() will sometimes return null

WordPress Trac noreply at wordpress.org
Fri Feb 28 17:08:45 UTC 2014


#21876: unregister_default_headers() will sometimes return null
------------------------------------+--------------------
 Reporter:  conner_bw               |       Owner:
     Type:  defect (bug)            |      Status:  new
 Priority:  normal                  |   Milestone:  3.9
Component:  Appearance              |     Version:  3.4.2
 Severity:  minor                   |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+--------------------

Comment (by aubreypwd):

 > Unless I'm missing something, the patch should only return true if all
 the headers were removed.

 > What is gained by having the function return true as soon as we have one
 successful removal of a number of header to be removed?

 If we did something like `true` if all were removed, and an `array()` of
 headers that weren't removed, I'm not sure what the receiving function
 would do with that either.

 I am assuming (because of my lack of full understanding of the function)
 that a person that does:

 {{{
 function _remove_twenty_ten_headers(){
     unregister_default_headers( array(
         'berries',
         'cherryblossom',
         'concave',
         'fern',
         'forestfloor',
         'inkwell',
         'path' ,
         'sunset')
     );
 }

 add_action( 'after_setup_theme', 'jorbin_remove_twenty_ten_headers', 11 );
 }}}

 ...they just want to make sure those are removed, as they maybe cause
 problems with the child theme, etc.

 I think the same `array()` could be returned with some information that
 would help the function or developer find out why false was returned.
 Might be more helpful for the developer if a header wasn't removed for any
 other reason than it was not in the array. Maybe help the developer take
 out unnecessary code?

 {{{
 array(
         'berries'=>true, //removed
         'cherryblossom'=>true,

         'concave'=>array(
                 false, //not removed
                 'not_present' //why
         ),

         'fern'=>array(
                 false, //not removed
                 'unable_to_remove' //why
         ),
         'forestfloor'=>true,
         'inkwell'=>true,
         'path'=>true,
         'sunset'=>true
     );
 }}}

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


More information about the wp-trac mailing list