[wp-trac] [WordPress Trac] #37369: registered_meta_key_exists() must return only Boolean, not WP_error as it is used by unregister_meta_key() and get_registered_metadata() which alredy return WP_error

WordPress Trac noreply at wordpress.org
Thu Jul 14 20:28:21 UTC 2016


#37369: registered_meta_key_exists()  must return only Boolean, not WP_error as it
is used by unregister_meta_key() and get_registered_metadata() which alredy
return WP_error
--------------------------------+-----------------------------
 Reporter:  vishalkakadiya      |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:  trunk
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 `registered_meta_key_exists()` must return only Boolean, not WP_error as
 it is used by `unregister_meta_key()` and `get_registered_metadata()`
 which has<br />

 {{{#!php
 <?php
 if ( ! registered_meta_key_exists( $object_type, $object_subtype,
 $meta_key ) ) {
                         return new WP_Error( 'invalid_meta_key', __(
 'Invalid meta key. Not registered.' ) );
                 }
 }}}

 this type of condition and if the WP_error is return then it will not
 throw error, but it goes further.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37369>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list