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
Found a bug or want to suggest an enhancement? Before completing your issue, please review our best practices: https://make.wordpress.org/cli/handbook/bug-reports/
6
+
7
+
Need help with something? GitHub issues aren't for general support questions, but there are other venues you can try: https://wp-cli.org/#support
We appreciate you taking the initiative to contribute to this project.
5
+
6
+
Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
7
+
8
+
For a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.
Searches through all or a selection of database tables for a given string, Outputs colorized references to the string.
340
+
341
+
Defaults to searching through all tables registered to $wpdb. On multisite, this default is limited to the tables for the current site.
342
+
343
+
**OPTIONS**
344
+
345
+
<search>
346
+
String to search for. The search is case-insensitive by default.
347
+
348
+
[<tables>...]
349
+
One or more tables to search through for the string.
350
+
351
+
[--network]
352
+
Search through all the tables registered to $wpdb in a multisite install.
353
+
354
+
[--all-tables-with-prefix]
355
+
Search through all tables that match the registered table prefix, even if not registered on $wpdb. On one hand, sometimes plugins use tables without registering them to $wpdb. On another hand, this could return tables you don't expect. Overrides --network.
356
+
357
+
[--all-tables]
358
+
Search through ALL tables in the database, regardless of the prefix, and even if not registered on $wpdb. Overrides --network and --all-tables-with-prefix.
359
+
360
+
[--before_context=<num>]
361
+
Number of characters to display before the match.
362
+
---
363
+
default: 40
364
+
---
365
+
366
+
[--after_context=<num>]
367
+
Number of characters to display after the match.
368
+
---
369
+
default: 40
370
+
---
371
+
372
+
[--regex]
373
+
Runs the search as a regular expression (without delimiters). The search becomes case-sensitive (i.e. no PCRE flags are added, except 'u' if the database charset is UTF-8). Delimiters must be escaped if they occur in the expression.
374
+
375
+
[--regex-flags=<regex-flags>]
376
+
Pass PCRE modifiers to the regex search (e.g. 'i' for case-insensitivity). Note that 'u' (UTF-8 mode) will not be automatically added.
377
+
378
+
[--regex-delimiter=<regex-delimiter>]
379
+
The delimiter to use for the regex. It must be escaped if it appears in the search string.
380
+
---
381
+
default: /
382
+
---
383
+
384
+
[--table_column_once]
385
+
Output the 'table:column' line once before all matching row lines in the table column rather than before each matching row.
386
+
387
+
[--one_line]
388
+
Place the 'table:column' output on the same line as the row id and match ('table:column:id:match'). Overrides --table_column_once.
389
+
390
+
[--matches_only]
391
+
Only output the string matches (including context). No 'table:column's or row ids are outputted.
392
+
393
+
[--stats]
394
+
Output stats on the number of matches found, time taken, tables/columns/rows searched, tables skipped.
395
+
396
+
[--table_column_color=<color_code>]
397
+
Percent color code to use for the 'table:column' output. For a list of available percent color codes, see below. Default '%G' (bright green).
398
+
399
+
[--id_color=<color_code>]
400
+
Percent color code to use for the row id output. For a list of available percent color codes, see below. Default '%Y' (bright yellow).
401
+
402
+
[--match_color=<color_code>]
403
+
Percent color code to use for the match (unless both before and after context are 0, when no color code is used). For a list of available percent color codes, see below. Default '%3%k' (black on a mustard background).
404
+
405
+
The percent color codes available are:
406
+
'%y' Yellow (dark) (mustard)
407
+
'%g' Green (dark)
408
+
'%b' Blue (dark)
409
+
'%r' Red (dark)
410
+
'%m' Magenta (dark)
411
+
'%c' Cyan (dark)
412
+
'%w' White (dark) (light gray)
413
+
'%k' Black
414
+
'%Y' Yellow (bright)
415
+
'%G' Green (bright)
416
+
'%B' Blue (bright)
417
+
'%R' Red (bright)
418
+
'%M' Magenta (bright)
419
+
'%C' Cyan (bright)
420
+
'%W' White
421
+
'%K' Black (bright) (dark gray)
422
+
'%3' Yellow background (dark) (mustard)
423
+
'%2' Green background (dark)
424
+
'%4' Blue background (dark)
425
+
'%1' Red background (dark)
426
+
'%5' Magenta background (dark)
427
+
'%6' Cyan background (dark)
428
+
'%7' White background (dark) (light gray)
429
+
'%0' Black background
430
+
'%8' Reverse
431
+
'%U' Underline
432
+
'%F' Blink (unlikely to work)
433
+
They can be concatenated. For instance, the default match color of black on a mustard (dark yellow) background '%3%k' can be made black on a bright yellow background with '%Y%0%8'.
434
+
435
+
**EXAMPLES**
436
+
437
+
# Search through the database for the 'wordpress-develop' string
438
+
$ wp db search wordpress-develop
439
+
wp_options:option_value
440
+
1:http://wordpress-develop.dev
441
+
wp_options:option_value
442
+
1:http://example.com/foo
443
+
...
444
+
445
+
# Search through a multisite database on the subsite 'foo' for the 'example.com' string
446
+
$ wp db search example.com --url=example.com/foo
447
+
wp_2_comments:comment_author_url
448
+
1:http://example.com/
449
+
wp_2_options:option_value
450
+
...
451
+
452
+
# Search through the database for the 'https?://' regular expression, printing stats.
453
+
$ wp db search 'https?:\/\/' --regex --stats
454
+
wp_comments:comment_author_url
455
+
1:https://wordpress.org/
456
+
...
457
+
Success: Found 99146 matches in 10.752s (10.559s searching). Searched 12 tables, 53 columns, 1358907 rows. 1 table skipped: wp_term_relationships.
458
+
459
+
460
+
314
461
### wp db tables
315
462
316
463
List the database tables.
@@ -451,21 +598,6 @@ The size defaults to a human-readable number.
451
598
$ wp db size --size_format=mb
452
599
6
453
600
454
-
### wp db prefix
455
-
456
-
Display the database table prefix.
457
-
458
-
~~~
459
-
wp db prefix
460
-
~~~
461
-
462
-
Display the database table prefix, as defined by the database handler's interpretation of the current site.
463
-
464
-
**EXAMPLES**
465
-
466
-
$ wp db prefix
467
-
wp_
468
-
469
601
## Installing
470
602
471
603
This package is included with WP-CLI itself, no additional installation necessary.
@@ -480,30 +612,25 @@ We appreciate you taking the initiative to contribute to this project.
480
612
481
613
Contributing isn’t limited to just code. We encourage you to contribute in the way that best fits your abilities, by writing tutorials, giving a demo at your local meetup, helping other users with their support questions, or revising our documentation.
482
614
615
+
For a more thorough introduction, [check out WP-CLI's guide to contributing](https://make.wordpress.org/cli/handbook/contributing/). This package follows those policy and guidelines.
616
+
483
617
### Reporting a bug
484
618
485
619
Think you’ve found a bug? We’d love for you to help us get it fixed.
486
620
487
621
Before you create a new issue, you should [search existing issues](https://github.com/wp-cli/db-command/issues?q=label%3Abug%20) to see if there’s an existing resolution to it, or if it’s already been fixed in a newer version.
488
622
489
-
Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/db-command/issues/new) with the following:
490
-
491
-
1. What you were doing (e.g. "When I run `wp post list`").
492
-
2. What you saw (e.g. "I see a fatal about a class being undefined.").
493
-
3. What you expected to see (e.g. "I expected to see the list of posts.")
494
-
495
-
Include as much detail as you can, and clear steps to reproduce if possible.
623
+
Once you’ve done a bit of searching and discovered there isn’t an open or fixed issue for your bug, please [create a new issue](https://github.com/wp-cli/db-command/issues/new). Include as much detail as you can, and clear steps to reproduce if possible. For more guidance, [review our bug report documentation](https://make.wordpress.org/cli/handbook/bug-reports/).
496
624
497
625
### Creating a pull request
498
626
499
627
Want to contribute a new feature? Please first [open a new issue](https://github.com/wp-cli/db-command/issues/new) to discuss whether the feature is a good fit for the project.
500
628
501
-
Once you've decided to commit the time to seeing your pull request through, please follow our guidelines for creating a pull request to make sure it's a pleasant experience:
629
+
Once you've decided to commit the time to seeing your pull request through, [please follow our guidelines for creating a pull request](https://make.wordpress.org/cli/handbook/pull-requests/) to make sure it's a pleasant experience. See "[Setting up](https://make.wordpress.org/cli/handbook/pull-requests/#setting-up)" for details specific to working on this package locally.
630
+
631
+
## Support
502
632
503
-
1. Create a feature branch for each contribution.
504
-
2. Submit your pull request early for feedback.
505
-
3. Include functional tests with your changes. [Read the WP-CLI documentation](https://wp-cli.org/docs/pull-requests/#functional-tests) for an introduction.
506
-
4. Follow the [WordPress Coding Standards](http://make.wordpress.org/core/handbook/coding-standards/).
633
+
Github issues aren't for general support questions, but there are other venues you can try: http://wp-cli.org/#support
507
634
508
635
509
636
*This README.md is generated dynamically from the project's codebase using `wp scaffold package-readme` ([doc](https://github.com/wp-cli/scaffold-package-command#wp-scaffold-package-readme)). To suggest changes, please submit a pull request against the corresponding part of the codebase.*
0 commit comments