Skip to content

Commit d35634a

Browse files
authored
Merge pull request #122 from austinginder/51-search-delete-docs
Add search and delete example
2 parents 91d1c0b + 372094a commit d35634a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/DB_Command.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,6 +1019,16 @@ public function prefix() {
10191019
* ...
10201020
* Success: Found 99146 matches in 10.752s (10.559s searching). Searched 12 tables, 53 columns, 1358907 rows. 1 table skipped: wp_term_relationships.
10211021
*
1022+
* # SQL search database table 'wp_options' where 'option_name' match 'foo'
1023+
* wp db query 'SELECT * FROM wp_options WHERE option_name like "%foo%"' --skip-column-names
1024+
* +----+--------------+--------------------------------+-----+
1025+
* | 98 | foo_options | a:1:{s:12:"_multiwidget";i:1;} | yes |
1026+
* | 99 | foo_settings | a:0:{} | yes |
1027+
* +----+--------------+--------------------------------+-----+
1028+
*
1029+
* # SQL search and delete records from database table 'wp_options' where 'option_name' match 'foo'
1030+
* wp db query "DELETE from wp_options where option_id in ($(wp db query "SELECT GROUP_CONCAT(option_id SEPARATOR ',') from wp_options where option_name like '%foo%';" --silent --skip-column-names))"
1031+
*
10221032
* @when after_wp_load
10231033
*/
10241034
public function search( $args, $assoc_args ) {

0 commit comments

Comments
 (0)