WordPress
How to Copy Comments to Another Post
I never knew it’s that simple to copy all comments from one WordPress post to another. The following snippet copies all posts from $post_id to $new_post_id.
get_comments() is a convenience function around WP_Comment_Query, so if you put this snippet inside a loop you can omit the ‘post_id’ parameter.
Oh, and if you don’t need to copy but to move the comments, you may be better off by just firing some good old SQL against your database:
Thoughts on Filtering by Time
Filtering WordPress WP_Query results by time. This article will look at different approaches to solve this problem.
WordPress is Vulnerable to DoS Attacks
WordPress is vulnerable to DOS Attacks via a hash table exploit. Fix: `suhosin.post.max_vars = 1000`
Find Users by Last Login Activity
There is no “last activity” field in WordPress. But it can be useful for all kinds of automatic user administation tasks. Learn how to add a custom user meta field and how to query for it.
Namespacing WordPress Plugins
Why namespaces? There are thousands of plugins out there and chances are good that someone writes a class or function with the same name as you do. Once a user activates both plugins, PHP doesn’t know which function to use and exits peacefully. Use namespaces to prevent this from happening.