Return to Snippet

Revision: 24843
at March 12, 2010 09:19 by mongolito404

Initial Code

$results = db_query("SELECT DISTINCT nid from node_revisions WHERE body REGEXP '<style>.*</style>' OR body REGEXP '<style>.*</style>'");

while($nid = db_result($results)) {
  $node = node_load($nid);
  $node->body = preg_replace('@<style[^>]*?>.*?</style>@siu', '',$node->body);

Initial URL

Initial Description
A simple script to run with [drush]( to clean all Drupal nodes containing style tags.

Initial Title
Remove style tags from Drupal node

Initial Tags
php, html, drupal

Initial Language