Posts

Showing posts with the label comment

Delete all pending/spam/trash comments from WordPress (Single or Multisite) using WP-CLI

I just wrote this bash shell script to delete all pending/spam/trash comments from WordPress (Single or Multisite) using WP-CLI: Put the script inside your WordPress root and run: $ ./clean_comments.sh These are available statuses of a comment: approve : approved comments hold : pending comments spam : spams trash : comments in the trash bin This is pretty neat huh?!

Cleaning up your WordPress Multisite instance with wp-cli

At some points in life, your WordPress Multisite will become too big and needs to be cleaned up, things like spam comments, revisions, transients... And of-course, you don't want to go blog by blog to clean up all those things. It may take days or weeks if you have > 1000 sites like mine. Here is your savior: WP-CLI WP-CLI is a command line tool which can help you manage your WordPress site flawlessly (:D). This blog post will show you how to use wp-cli to clean up your WordPress Multisite including: 1. Transients: Create a shell script inside your WordPress dir root: $ cd /path/to/wordpress/root $ sudo nano clean_transients.sh #!/bin/bash for url in $(wp site list --field=url --allow-root) do   echo $url #used for progress purposes   wp transient delete-all --url=$url --allow-root done $ sudo chmod +x clean_transients.sh $ sudo ./clean_transients.sh --allow-root 2. Spam comments: $ cd /path/to/wordpress/root $ sudo nano clean_comments.sh ...

edx-platform - How to delete a comment thread in discussion

Right now, there is no UI for deleting a comment  thread in a course in Open EdX, you have to do it at the server side: 1. Get the comment thread ID by looking at the URL, for example: http://mydomain.com/courses/MYSCHOOL/Cu_001/201405/discussion/forum/i4x-MYSCHOOL_X_001-course-201405/threads/ 53b0eeec1240cdb524333331 2. Go the the server, access the mongodb cli, delete the comment by ID: edxapp@demo:~/edx-platform$ mongo MongoDB shell version: 2.4.10 connecting to: test Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see         http://docs.mongodb.org/ Questions? Try the support group         http://groups.google.com/group/mongodb-user > use cs_comments_service_development switched to db cs_comments_service_development >  db.contents.remove({"_id": ObjectId("53b0eeec1240cdb524333331")}) P/S: I also updated this to the documentation of OpenEdX's comme...