• Resolved Lisa Linn Allen

    (@spacegrrl)


    it’s pretty clear how to limit wp-cli search-replace to a small set of columns – but is there a way to limit its action to a set of rows? i want to change links found in a set of posts, but leave those same links alone if found in other posts. there doesn’t seem to be a way to do this, and using a mySQL command to (via wp-cli) to find/replace on serialized postmeta is… ugh.

    totally open to other approaches that can be automated for what i’m trying to do here.

Viewing 2 replies - 1 through 2 (of 2 total)
  • but is there a way to limit its action to a set of rows?

    It’s not possible, no.

    i want to change links found in a set of posts, but leave those same links alone if found in other posts. there doesn’t seem to be a way to do this, and using a mySQL command to (via wp-cli) to find/replace on serialized postmeta is… ugh.

    Have you considered creating a custom table with the same schema as wp_postmeta, copying the rows you want to modify to those tables, and then copying the data back after you’ve performed the search/replace procedure?

    It’d require a little bit of custom scripting, but it seems like you could do this in an automated manner.

    Thread Starter Lisa Linn Allen

    (@spacegrrl)

    Thanks Daniel – that’s a great idea, I bet I could do that.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp-cli search-replace, limit rows’ is closed to new replies.