Ability to Exclude Revisions from `wp db search`

Open
#156 1 comment 20 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
mariadb, mysql, php
Domain
cli, database

Research direction

Start at the wp db search command entry point and trace how its options and database search are defined. Review the existing command tests and documentation, if available; done means an --exclude-revisions option works and matching revision records are omitted from results.

Written by the indexing model from the issue text.

Description

command:db command:db-search

Describe your use case and the problem you are facing

I often use wp db search to determine if a certain shortcode, class, etc. is in use. These search results include revisions, so it's possible that a search with 10 results only represents a single post. This makes the function significantly less useful for what feels like a pretty simple use case.

Describe the solution you'd like

The simplest solution would be some type of standalone flag so I could do something like wp db search 'string' --exclude-revisions.

My only hesitancy in suggesting this is wondering whether some more generalized way to include or exclude other things would be useful. On the flipside, a super powerful way to limit the search query would probably end up being much less user-friendly.

Dominant language
PHP
Stars
76
Forks
73
Avg merge
9h 31m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from wp-cli/db-command

All issues in wp-cli/db-command

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.