Opened 10 years ago
Closed 10 years ago
#37369 closed defect (bug) (invalid)
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
| Reported by: | vishalkakadiya | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Options, Meta APIs | Version: | 4.6 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
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 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.
Attachments (2)
Change History (6)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Refresh this patch added comment and removed if conditions from unregister_meta_key() as it is already checked in registered_meta_key_exists()