You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add example of how to search and delete results #51
For those wanting to clean up parts of their database, it'd be neat to have a wp db search example indicating how to search for a string and delete the resulting database entry.
danhgilmore [7:14 AM] I think I've asked this in the past, but I'm just now getting back to working with wp-cli....is there a way to search/delete instead of search/replace?
[7:15] I am cleaning up our DB, and there's a lot of things orphaned in the wp_X_options tables that I'd like to search for and then remove.
janw.oostendorp [7:37 AM] pass an empty string within quotes? Won't delete empty meta/options
danhgilmore [7:38 AM] Yeah, I'm trying to remove the records from the database 😕
Hey @danielbachhuber I couldn't find a properly command/method to perform this kind of action, however, while reading the code of wp db seach, I figured that we could add a new arg to wp db search, something like --delete-records, which would properly fit in these cases.
What are your thoughts about this idea? If you do think that this would be a good idea, I could volunteer to implement that.
@marksabbath I think that would make more sense as a separate command, as deleting rows is not a variation of "searching", but rather a completely different operation.
Also, it would need safety features like --dry-run or --interactive.
Do you care to add this as a new issue to wp-cli/ideas to discuss in more detail?
Activity
marksabbath commentedon Dec 2, 2017
Hey @danielbachhuber I couldn't find a properly command/method to perform this kind of action, however, while reading the code of
wp db seach, I figured that we could add a new arg towp db search, something like--delete-records, which would properly fit in these cases.What are your thoughts about this idea? If you do think that this would be a good idea, I could volunteer to implement that.
schlessera commentedon Jan 8, 2018
@marksabbath I think that would make more sense as a separate command, as deleting rows is not a variation of "searching", but rather a completely different operation.
Also, it would need safety features like
--dry-runor--interactive.Do you care to add this as a new issue to
wp-cli/ideasto discuss in more detail?marksabbath commentedon Jan 10, 2018
You bet @schlessera gonna add that there right away.
missjwo commentedon May 19, 2018
Not sure if this is helpful, but I recently just had to do
for a project
danielbachhuber commentedon Jan 24, 2019
Addressed in #122