Do you have SSH access? WP-CLI via search-replace
.
$ wp search-replace '<script>bad javascript code</script>' '' --precise
By default, this only searches for tables registered in $wpdb
. To overwrite this behaviour, you can use either the --all-tables
or --all-tables-with-prefix
flag. (Or pass table names to the command manually.)
Alternative: Easiest would be to download a dump, search/replace in that file and finally import again.
- Download complete db backup
- search & replace with your favourite text editor, replacing
<script>bad javascript code</script>
through an empty string - Delete tables
- Upload your edited backup