Skip to main content
5 events
when toggle format what by license comment
May 23, 2023 at 9:16 comment added Tom J Nowell Additionally, if you have a $post_ids list in a file, why would you need to use WP_Query to fetch posts? Just grab the IDs from the file, and call update_post_meta with them
May 23, 2023 at 9:15 comment added Tom J Nowell you can request just the post IDs from WP_Query but it means that WP won't prefetch values in bulk to optimise, so if you do anything it will trigger lots of tiny SQL queries which might be slower. E.g. when you do a normal WP_Query it fetches the posts row, but it also fetches all its meta and all its terms at the same time to reduce the number of queries and round trips. None of that happens if you just fetch the IDs
May 22, 2023 at 23:51 comment added Malachi @TomJNowell Thank you. I just tested that, and yes.. when I run some raw SQL, it won't update caches... so I'll have to do it using update_post_meta then. Is there a simple way to run wp_query to just get an array of posts id's where the value of field xx is Yes (or No)?
May 16, 2023 at 8:36 comment added Tom J Nowell note that using raw SQL will not run filters hooks or update/flush caches, depending on the way the site is configured you might see weirdness, e.g. code to update a CDN when a page changes would be unaware you changed the DB directly, the same with caching plugins
May 16, 2023 at 7:31 history answered mWin CC BY-SA 4.0