Skip to content

wp search-replace --precise skips a row with an integer-looking text primary key #259

Backlog

Description

@elphizu

Bug Report

Describe the current, buggy behavior

wp search-replace --precise can match distinct text keys like '001' and '1' in the same lookup. I reproduced this locally with two seeded rows in Wordfence's file-change table. The command reported one replacement and left row '1' unchanged. Wordfence

Describe how other contributors can replicate this bug

Run these commands on a disposable WordPress install with MySQL and the default wp_ prefix.

wp db query "
CREATE TABLE wp_sr_key_test (
  id VARCHAR(10) NOT NULL PRIMARY KEY,
  url TEXT NOT NULL
);
INSERT INTO wp_sr_key_test (id, url) VALUES
  ('001', 'https://old.example/foo'),
  ('1',   'https://old.example/bar');
"

wp search-replace 'https://old.example' 'https://new.example' wp_sr_key_test \
  --all-tables-with-prefix --include-columns=url --precise

wp db query "SELECT id, url FROM wp_sr_key_test ORDER BY id;"

The command reports Success: Made 1 replacement. The query returns these rows.

id      url
001     https://new.example/foo
1       https://old.example/bar

Describe what you would expect as the correct outcome

The command should report two replacements. Key '001' should contain https://new.example/foo, and key '1' should contain https://new.example/bar.

Let us know what environment you are running this on

Relevant wp cli info output follows.

OS:				 Darwin 27.2.0 (arm64)
Shell:           /bin/zsh
PHP version:     8.4.28
WP-CLI version:  3.0.1
WordPress 		 7.1.5
MySQL			 8.4.13

Activity

  1. added
    command:search-replace
    status:unconfirmed
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcommand:search-replacestatus:unconfirmed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions