Handle JSON-encoded URLs in search-replace#213
Merged
swissspidy merged 6 commits intomainfrom Mar 11, 2026
Merged
Conversation
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix font URL not updating with wp search-replace
Handle JSON-encoded URLs in search-replace (WordPress font data)
Mar 11, 2026
This comment was marked as resolved.
This comment was marked as resolved.
…ost content Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
…m SearchReplacer Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
… update, and log JSON variants Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
swissspidy
reviewed
Mar 11, 2026
Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SearchReplacer::run_recursively()to also replace JSON-encoded versions of the search/replace stringsSearch_Replace_Command::php_handle_col()WHERE clause to also match JSON-encoded search stringSearch_Replace_Command::sql_handle_col()to also REPLACE JSON-encoded version using a single nestedREPLACE(REPLACE(...))in one table pass, avoiding double-counting rows that match both plain and JSON-encoded formsSearch_Replace_Command::sql_handle_col()dry-run COUNT to use a singleSELECT COUNT ... WHERE col LIKE '%old%' OR col LIKE '%old_json%'query instead of two separate queries, so rows are counted only onceSearch_Replace_Command::sql_handle_col()logging: also calllog_sql_diff()with$old_json/$new_jsonwhen they differ, so JSON-encoded matches appear in--dry-runlog output and non-dry-run diff logsjson_encode_strip_quotes()public static helper inSearch_Replace_Commandto reduce duplication; call it fromSearchReplacerto eliminate the duplicated inlinejson_encode+ quote-strip logicjson_encode()returningfalse(e.g. invalid UTF-8) gracefully in both fileswp post create --post_content='...' --post_status=publish --porcelaininstead of a PHP eval-file with$wpdb->insert()Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.