WP CLI is a great tool for performing common admin and maintenance tasks on a WordPress install. It has a large range of commands that among other things allow you to install plugins, regenerate thumbnails, and in your case, perform a search and replace on the database.
When migrating from dev to production I’d normally run the following command to update URLs in the database:
wp search-replace '//dev.example.com/' '//www.example.com/'
With your existing URL structure you’ll probably need to include the href="https://wordpress.stackexchange.com/questions/276781/
in the search and replace string like so:
wp search-replace"href="https://wordpress.stackexchange.com/" 'href="http://example.com/'
Related Posts:
- Access files at new location using old file paths
- Preserve old website URL structure after migrating to WordPress
- Root-relative paths being rewritten on ‘Edit Page’ [closed]
- URLs unchanged after migration
- Migration from old CMS to WordPress 301 redirection rules?
- How do you create a “virtual” page in WordPress
- Multiple endpoints to same page
- How to make a category page the blog home page?
- Preserving $_GET parameter while using custom Rewrite Rule
- Taxonomy rewrite question
- Rewrite rules in .htaccess get overwritten?
- Getting add_rewrite_rule and add_rewrite_tag to work
- Why did installing wordpress in url root jack up underlying WP sites?
- How do I create a dynamic page?
- Dynamic URL, not a physical page within the database
- Passing & Reading URL Parameters with URL re-writing
- Prevent WordPress from automatically correcting URLs
- add_rewrite_rule and pagination issue
- Display content according to current URL
- Nginx rewrite rule conflict with WordPress permalinks rule
- External/non-WP rewrite rule without QSA
- How to do Basic URL Rewrite Without Redirecting
- URL Rewrite doesn’t work for nested pages
- url rewrite parsing a custom url parameter not working
- How to add custom variable in url without redirect?
- Using category slug in add_rewrite rule
- Adding pretty query parameters
- Pass a comment id through url and append the comment post’s slug in the url
- How to change the main site url on a multisite installation (network)?
- Problem with add_rewrite_rule
- add_rewrite_rule ignoring other params than the “p” param
- optimize wordpress rewrite rule regex
- How to catch Rewrite rules then display a specific post?
- Adding two rewrite rules
- Load an url with minimal/no DB queries
- Login page is redirecting to homepage
- .htaccess rewrite
- Auto generate rewrite rules for multiple taxonomies
- Generating a Rewrite Rule for sSecific Post-Requests from a Submitted Form?
- Change htaccess to redirect to index.php in subfolder
- Rewrite URLs – Custom Post Type – Post Slug, Taxonamy Slug
- URL Rewriting for PHP script on an image URL
- rewrite url for authors
- How to redirect specific URL to Subdomain
- How to rewrite wordpress urls with index.php in them
- Force search form to go to clean url without multiple redirects
- Rewrite query string to path
- map multiple URLs to display home page without changing URL displayed in browser’s location bar
- WordPress Autocorrect URL / Slugs Does Not Work
- Rewrite API -Adding a parameter before the slug
- Replace term archives with static pages
- Why does my URL rewriting only work using two different methods?
- Using a custom 410 page
- IIRF + IIS 6 + WordPress does not return 404 error
- Rewrite vs Redirect from ?p={ID}
- Is it possible to set the same base for categories and tags?
- Adding a rewrite rule to page that has no fixed variables and pagination
- Flush rewrite rules on option update with Settings API
- Integer based rewrite isn’t recognized for value of 1
- Re-directing URLs with dates to URLs without dates
- Having WordPress control only certain pages with .htaccess?
- wordpress url correction
- Help with a custom rewrite
- My bbPress rewrite rules aren’t working
- Not able to rewrite the pagination URL for the posts
- On a Https site, Css and Js Url are back to http after redirect the site
- add_rewrite_tag works for some parameters but does not for others
- Rewrite specific action url
- 301 Rewriting htaccess
- Using page as front page, why does /page/### work?
- Rewrite rule shows 404 page
- How to transform multiple parameter URL to clean URL
- Exclude subfolder in WordPress permalink
- wordpress path generation from rewrite rule
- How to add dot(“.”) in post slug
- WordPress pagination broken for page 2,3 with custom permalink. Redirects to baseurl
- Rewrite rule for custom permalink structure
- Help with .htaccess setup to hide WordPress Directory
- Ugly URLs when there’s pagination
- Unable to access the query variables in the template
- Hide wordpress source code
- Why is there a 404 on page 2+ for my search page?
- Custom rewrite from URL to URL using slug
- URL duplicating after migrating domain
- URL rewrite before template_redirect called
- Properly maintaining an old rewrite structure
- Custom Post type and Custom taxonomy with URL rewrite worked but template did not
- Add dynamic url with external page in WordPress
- .htaccess RewriteBase equivalent for WordPress – Passing a URL as a variable without getting a 404
- URL Rewrite for CPT single posts
- Using 2 URL’s for WordPress
- Rewriting WordPress URLs
- Need Help With A Rewrite Issue
- Function to rewrite URl in WordPress
- Can’t get pretty permalinks to work without index.php
- How to rename the WordPress wp-login.php running on IIS6?
- get parameter from url rewrite [closed]
- Generated URLs don’t reflect accurate URLs.
- Rewrite rule to simulate page hierarchy results in 404
- add_rewrite_rule not working with custom variables