Title: wp-cli search-replace, limit rows
Last modified: July 18, 2017

---

# wp-cli search-replace, limit rows

 *  Resolved [Lisa Linn Allen](https://wordpress.org/support/users/spacegrrl/)
 * (@spacegrrl)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/wp-cli-search-replace-limit-rows/)
 * 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)

 *  [Daniel Bachhuber](https://wordpress.org/support/users/danielbachhuber/)
 * (@danielbachhuber)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/wp-cli-search-replace-limit-rows/#post-9331210)
 * > 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](https://wordpress.org/support/users/spacegrrl/)
 * (@spacegrrl)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/wp-cli-search-replace-limit-rows/#post-9334010)
 * 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.

## Tags

 * [wp-cli](https://wordpress.org/support/topic-tag/wp-cli/)

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [Lisa Linn Allen](https://wordpress.org/support/users/spacegrrl/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/wp-cli-search-replace-limit-rows/#post-9334010)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
