Jump to content

Bulk-Delete all Posts with particular content


Surendra.S

Recommended Posts

Posted

Hi All,

Any idea how can I delete all posts with exact match to a particular content ?

I used IPB 'Search' feature to view there are 2000 posts with exact match to the particular phrase.

But I can't find the moderation option to SELECT ALL those posts & DELETE.

 

Posted
10 minutes ago, Ramsesx said:

Because there is no (sadly).

Thank You for the reply sir.

Any there any other way you can think of ?

I am open to executing a DELETE query also on database.

Posted
3 hours ago, Surendra.S said:

Thank You.

I doubt if they will help with custom query like this.

But let me try.

if any others are aware of what to do for this type of requirement, please reply.

You can try the following, but first of all make a backup of your database.

To select all posts that contain a certain keyword, run this query at the sql box of phpmyadmin, or whatever tool your host is using to manage the databases.

SELECT * FROM forums_posts WHERE post LIKE '%keyword%';

2 things to note here. If you are using a prefix for your database, append it to the table name in the query above and replace keyword with the word that you want to use as a match for all posts containing it.

Then select the rows that will be displayed and delete them.

Or you can use this query to simply remove only that word from all posts by replacing it with a blank space, without the post(s) itself being deleted.

UPDATE forums_posts SET post = REPLACE(post, 'keyword', '') WHERE post LIKE '%keyword%';

Hope it helps.

Posted
1 hour ago, Faqole said:

You can try the following, but first of all make a backup of your database.

To select all posts that contain a certain keyword, run this query at the sql box of phpmyadmin, or whatever tool your host is using to manage the databases.


SELECT * FROM forums_posts WHERE post LIKE '%keyword%';

2 things to note here. If you are using a prefix for your database, append it to the table name in the query above and replace keyword with the word that you want to use as a match for all posts containing it.

Then select the rows that will be displayed and delete them.

Or you can use this query to simply remove only that word from all posts by replacing it with a blank space, without the post(s) itself being deleted.


UPDATE forums_posts SET post = REPLACE(post, 'keyword', '') WHERE post LIKE '%keyword%';

Hope it helps.

Thank You Sir !

I have decent knowledge on queries. So I understand what you mentioned above.

In fact, its a nice idea to UPDATE the posts instead of DELETING.

But my requirement is to DELETE all the posts that have the particular keyword.

I can write the query for that also.

But I have no idea what consequences might be there if I DELETE the posts. 

(For eg, the Deleted posts may have references in other tables, and it may affect the post counts etc)...

Cannot understand why IPB did not provide any MODERATION options in Search Results page.

Posted
33 minutes ago, Surendra.S said:

Thank You Sir !

I have decent knowledge on queries. So I understand what you mentioned above.

In fact, its a nice idea to UPDATE the posts instead of DELETING.

But my requirement is to DELETE all the posts that have the particular keyword.

I can write the query for that also.

But I have no idea what consequences might be there if I DELETE the posts. 

(For eg, the Deleted posts may have references in other tables, and it may affect the post counts etc)...

Cannot understand why IPB did not provide any MODERATION options in Search Results page.

Personally I would advice against deleting stuff from the database as it might cause complications. However, post counts will be affected anyways, no matter how a post is deleted. 

That being said, a better way to do that is to write a script/app to delete the posts properly. 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...