Skip to main content

Timeline for Plugin exceeds memory limit

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Aug 28, 2017 at 10:08 comment added Milan Petrovic WordPress deletes from posts, postmeta (connect post.ID to postmeta.post_id), term_relationships (connect post.ID to term_relationship.object_id) and comments tables. And, after that, it has to run update for the terms counts.
Aug 28, 2017 at 10:06 comment added beeef Do you know what I need to delete for each post? post, postmeta, term_relationships - there exist no comments or terms for the posts.
Aug 28, 2017 at 10:04 comment added Milan Petrovic It is much better idea to delete such a large number of posts using only SQL queries. It would be a complex query with multiple joins (to delete posts, post meta, comments and any terms posts can have), but it will be fast, and no PHP memory issues.
Aug 28, 2017 at 10:00 comment added beeef Nice! Didn't know such a function exists. Thanks, I'll try that.
Aug 28, 2017 at 9:58 comment added Milan Petrovic Try to use 'wp_cache_flush()' function, it will clear the WordPress object cache. But, it is not a good idea to run it after each deletion, maybe call it after every 1000 posts deleted.
Aug 28, 2017 at 9:55 comment added beeef Can I manually clear the memory to free up space? Or should I repeatedly call the script as long as there are posts left and limit it to 5.000 posts per call?
Aug 28, 2017 at 9:51 review First posts
Aug 28, 2017 at 16:22
Aug 28, 2017 at 9:50 history answered Milan Petrovic CC BY-SA 3.0