Timeline for Access $post object when adding custom columns to list table
Current License: CC BY-SA 4.0
3 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 28, 2020 at 9:42 | comment | added | Tom J Nowell♦ |
That's not true, when WordPress fetches a post, it also fetches all its post meta in advance and stores it in WP_Cache. That way post meta gets cached in memory for that request, and WP avoids lots of little DB queries on get_post_meta calls. If you've got a persistent object cache set up such as a Redis or Memcache dropin, then it's even faster as it'll fetch the post object and its post meta from RAM avoiding the database completely ( I strongly recommend object caches for massive performance gains )
|
|
May 28, 2020 at 9:20 | comment | added | Will Fairhurst | Thanks Tom. I'm trying to avoid using get_post_meta as it requires another DB query which will, degrade performance significantly as the number of products gets into the 1000s. The get_post option might work well though. Will revert. Cheers | |
May 28, 2020 at 9:17 | history | answered | Tom J Nowell♦ | CC BY-SA 4.0 |