[wp-trac] [WordPress Trac] #42699: WP_Post $post object not properly returning values for meta keys

WordPress Trac noreply at wordpress.org
Sat Nov 25 23:09:46 UTC 2017


#42699: WP_Post $post object not properly returning values for meta keys
--------------------------------+-----------------------------
 Reporter:  saiu                |      Owner:
     Type:  defect (bug)        |     Status:  new
 Priority:  normal              |  Milestone:  Awaiting Review
Component:  Options, Meta APIs  |    Version:  4.9
 Severity:  normal              |   Keywords:
  Focuses:                      |
--------------------------------+-----------------------------
 I am using the $post->metakey property to retrieve meta values for a
 custom post type. Of the 8 posts of that type, 2 successfully return the
 meta value. The other 6 do not, giving the error:

 {{{
 <b>Notice</b>:  Trying to get property of non-object in [php file]
 }}}

 I checked the DB, and compared the meta keys—they are all identical and
 correct. I checked the post_id column against the admin front-end and the
 post IDs all match. The meta key is "projectlink" and the values are all
 addresses as strings. Nothing unusual, no quotes. The intermittent
 behavior has me baffled, so I'm concluding that there must be some sort of
 bug in how WP_Post attaches meta key/values to itself.

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


More information about the wp-trac mailing list