Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#18215 closed defect (bug) (duplicate)

Wrong method signature: get_post_meta

Reported by: luis.ferro Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Posts, Post Types Keywords:
Focuses: Cc:


On wp-includes/post.php, around line 1458, there is the following signature of a method:

function get_post_meta($post_id, $key, $single = false)

This is incorrect and should be:

function get_post_meta($post_id, $key = null, $single = false)


p.s.- the only effect of this is a warning on the IDE that you can use and naturally a possibility of some warnings on PHP, if they are not squelched.

Change History (2)

comment:1 ocean903 years ago

  • Keywords close added

$key is always required, there should be no default value.

comment:2 dd323 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

$key is always required, there should be no default value.

Actually the underlying meta API allows it to be skipped to return all meta for a post object.

There's a duplicate ticket though: #17013

Note: See TracTickets for help on using tickets.