[wp-trac] [WordPress Trac] #63174: PHP Warning: Undefined array key 0 in .../wp-includes/meta.php on line 651
WordPress Trac
noreply at wordpress.org
Tue Mar 25 18:28:58 UTC 2025
#63174: PHP Warning: Undefined array key 0 in .../wp-includes/meta.php on line 651
--------------------------+-----------------------------
Reporter: wpSight | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
I have WordPress 6.8-beta3-60069 with PHP 8.3 installed.
When I use `get_post_meta()` with a not existing beta key for the current
post the warning
Warning: Undefined array key 0 in wp-includes\meta.php on line 651
appears.
This messages is realted to `return $check[0];`
`$check` is an array, but empty. Thats why the key `[0]` does not exist.
You can check with a random request
`$duration = get_post_meta( $post_id, 'random_key', true );`
--
Ticket URL: <https://core.trac.wordpress.org/ticket/63174>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list