Limit search-replace in DB --wp_db_id="wp_posts:1234" (New command parameter)
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 35/100
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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"
- Langage dominant
- Gherkin
- Étoiles
- 61
- Forks
- 47
- Merge moyen
- 8 min
- PR mergées (30 j)
- 1
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de wp-cli/search-replace-command
-
bug command:search-replace scope:distribution state:unconfirmed
Difficulté 4/5 3-5 jours Accessibilité débutants 45/100
wp-cli/search-replace-command#231 · 5 commentaires ·
-
command:search-replace
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 35/100
wp-cli/search-replace-command#194 · 1 commentaire ·
-
command:search-replace contributor-day
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
wp-cli/search-replace-command#186 · 2 commentaires · 11 réactions ·
-
command:search-replace
Difficulté 3/5 1-2 jours Accessibilité débutants 52/100
wp-cli/search-replace-command#137 · 6 commentaires · 4 réactions ·
-
Progress bar Ouvertecommand:search-replace
wp-cli/search-replace-command#134 · 1 commentaire · 6 réactions · 1 personne assignée ·
Toutes les issues de wp-cli/search-replace-command
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
area:tools bug good first issue help wanted priority:P2
Difficulté 2/5 1-3 heures Accessibilité débutants 90/100
TaewoooPark/Motifcode#14 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
caddyserver/caddy#8046 ·
-
P3 tool/tts type/bug
Difficulté 1/5 Moins d'une heure Accessibilité débutants 90/100
NousResearch/hermes-agent#117794 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
vadimdemedes/ink#1029 ·