Tag: WP-CLI

  • Change post type for WordPress posts with WP-CLI

    In this example, I’m modifying all the posts with a legacy custom post type that I want to get rid of to use the Yoast SEO: Local custom post type for locations instead.

    wp post update $(wp post list --post_type=locations --format=ids) --post_type=wpseo_locations
  • Run WP-CLI commands on Pagely without errors from PHP version

    I hit an issue on Pagely where I was running a WP-CLI command – via SSH – but I kept hitting a PHP fatal error.

    When I looked into the error it was because the site was running PHP 7.4, but WP-CLI on Pagely was running PHP 7.3 so my code was breaking on the command line.

    Turns out all you need to do is use pagely-wp instead of wp (thanks Kevin!) and the command will run at the correct version of PHP.

    So instead of:

    wp search-replace staging.website.com www.website.com
    

    Do:

    pagely-wp search-replace staging.website.com www.website.com
    
  • Install WordPress at specific version with wp-cli-valet

    wp valet new sitename --version=5.8.2
    
  • Website not loading after clone in WP Engine control panel

    If this happened to you like it did to me don’t assume – like I did – that WP Engine’s clone tool does a search and replace on your database to update the URL too.

    Instead, when I spoke to WP Engine support they suggested it had to be done as a separate step.

    Me: I thought that would happen as part of the clone process

    Me: So next time we do a clone we should do a manual search and replace in the database too?

    WP Engine Support: Correct.

    WP Engine Support: Or jump on chat and we can help.

    I still feel like this should happen automatically – maybe I was just unlucky on this occasion – but if it happens to you you can do a search and replace via the Advanced menu, if you have it available, in the WP Engine admin under the install you’re trying to fix.

    To do this, use the wp search-replace command in WP-CLI, e.g.

    wp search-replace urloforiginalsite.com newinstallurl.wpengine.com

    Otherwise just ask WP Engine support and they’ll do it for you.