Limit search-replace in DB --wp_db_id="wp_posts:1234" (New command parameter)
还没有人认领这个 Issue。
评估
调研方向
Start at the wp search-replace command entry point and inspect how it selects database tables and records. Add support for the table:id form, including the documented WordPress ID mappings and optional comma-separated IDs. Done means a dry run changes only the requested records while existing unrestricted searches continue to work.
由索引模型根据 Issue 内容生成。
描述
I often want to apply the wp search-replace command to only one single database record. (Sometimes for testing, sometimes, because I know, that I only have to replace data in one post.) Most often it's a single post ID in wp_posts.
Current situation:
The following command makes a dry run to replace "each and every" match of class="old". It's not possible to limit it to one id of a specific WordPress table.
wp search-replace 'class="old"' 'class="new"' --log --dry-run
Feature request
Add a new command parameter (--wp_db_id="") to set the database table name and the id of a record in order to limit the search-replace command.
--wp_db_id="wp_posts:123"
The correct id field for each WordPress entity is mapped automatically internally. See example below.
Mapping example
--wp_db_id="wp_posts:123"(translates internally into wp_posts.ID=123)--wp_db_id="wp_options:789"(translates into wp_options.option_id=789)--wp_db_id="wp_terms:1823"(translates into wp_terms.term_id=1823)
--wp_db_id="{WordPress table name}:{id}"
New command demo
The new command looks like this. It only replaces the record with wp_options.option_id=789.
wp search-replace 'class="old"' 'class="new"' --wp_db_id="wp_options:789" --log --dry-run
Exra feature: Comma separated list of ids
May it's also possible, to add more than one id.
--wp_db_id="wp_terms:1823,1233,2399"
- 主要语言
- Gherkin
- 星标
- 61
- 派生
- 47
- 平均合并
- 8 分钟
- 30 天内合并 PR
- 1
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
wp-cli/search-replace-command 的其他 Issue
-
bug command:search-replace scope:distribution state:unconfirmed
难度 4/5 3-5 天 新手友好度 45/100
wp-cli/search-replace-command#231 · 5 条评论 ·
-
command:search-replace
难度 5/5 一周以上 新手友好度 35/100
wp-cli/search-replace-command#194 · 1 条评论 ·
-
command:search-replace contributor-day
难度 5/5 一周以上 新手友好度 25/100
wp-cli/search-replace-command#186 · 2 条评论 · 11 个 reaction ·
-
command:search-replace
难度 3/5 1-2 天 新手友好度 52/100
wp-cli/search-replace-command#137 · 6 条评论 · 4 个 reaction ·
-
Progress bar 未关闭command:search-replace
wp-cli/search-replace-command#134 · 1 条评论 · 6 个 reaction · 已指派 1 人 ·
查看 wp-cli/search-replace-command 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
kwakseongjae/auto-hwp#319 ·
-
area:cli bug filter-quality good first issue priority:medium
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 76/100
-
难度 2/5 1-3 小时 新手友好度 78/100
AvengeMedia/DankMaterialShell#3523 ·
-
comp/cli comp/cron P3 type/bug
难度 2/5 1-3 小时 新手友好度 76/100
NousResearch/hermes-agent#117433 · 2 条评论 ·