[development] [support] mass removal of content types

Brian Vuyk brian at brianvuyk.com
Thu Oct 14 00:23:33 UTC 2010


If I had to do this, I would use the devel module's PHP evaluation.

Install devel, go to http://www.yoursite.com/devel/php and enter the 
following code snippet:

// Begin code snippet
$results = db_query("SELECT nid FROM {node} WHERE type='product' LIMIT 
200");

while ($r = db_fetch_object($results)) {
   node_delete($r->nid);
}
// end code snippet

This will delete 200 nodes each pass. Of course, adjust 'product' to the 
machine name of the content type you want to delete.

Brian

On 10-10-13 07:58 PM, Pierre Rineau wrote:
> On Wed, 2010-10-13 at 20:47 -0300, Gastón Pablo Pérez wrote:
>    
>> Hi!
>>
>> I need to know if there is an special module or a simple way to remove
>> all contents of a particular type of content. I mean I need to delete
>> hundreds of products in my ubercart, so I need to delete all nodes
>> that corresponds to node type product, and i need to do this work in a
>> simple way.
>>
>> Thanks in advance
>>
>> best regards
>>
>> "La perseverancia es un árbol de raíces amargas, pero de frutos muy
>> dulces."
>>      
> May be the devel module would carry such feature. You should check it.
>
> Another solution is to use Views Bulk Operation, with it, you will be
> able to create a node view based on content type and other filters, then
> delete all of them in one batch.
>
> Pierre.
>
>    



More information about the development mailing list