• Fix Uncaught Error: Illegal offset type in vip-debug-bar-panels.php

    Receiving the following error when trying to add a new page in the WordPress admin on a local install of a WordPress VIP site:

    Fix Fatal error: Uncaught Error: Illegal offset type in isset or empty in mu-plugins/vip-helpers/vip-debug-bar-panels.php on line 384

    Fixed (locally) by modifying the function to return early:

    public function log_http_requests( $args, $url ) {
    	return $args;
    	/* ... */
    }
    
  • Install WordPress at specific version with wp-cli-valet

    wp valet new sitename --version=5.8.2
    
  • Download WordPress VIP database to local install

    First, download what you need via VaultPress and then merge the files with the following command in the terminal. (It helps to name filename.sql to the database name you are going to import to).

    cd Downloads/unzipped-folder/sql
    cat *.sql > filename.sql

    If you don’t want to overwrite the current database, comment out the previous one and create a new one in wp-config.php:

    # define( 'DB_NAME', 'databasename' );
    # define( 'DB_NAME', 'databasename_preprod' );
    define( 'DB_NAME', 'databasename_2023-03-19' );

    Place the file you downloaded in the WordPress root folder (where wp-config.php is, i.e. ‘above’ the wp-content folder etc.).

    (If you are using Local for your local site environment, you may need to access the terminal via the menu option in there, rather than the regular Terminal app, for the following commands to work).

    If you want to overwrite an existing database you will need to drop it first. With wp-cli installed, run the following command from the WordPress root folder:

    wp db drop

    Then:

    wp db create
    wp db import
    wp search-replace livesite.com localsite.test

    Or for preprod sites:

    wp search-replace www-preprod-url-vip.net localsite.test

  • 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.

  • Convert .pfx SSL certificate to .cer

    From the command line, replacing the filename as necessary (you will need the password for the certificate, if one is assigned):

    $ openssl pkcs12 -in wildcard.filename.com_2022.pfx -out wildcard.filename.com_2022.cer -nodes

    I needed to do this to convert a .pfx SSL certificate for use with Pagely.