• Get true or false from ACF field without using get_field()

    $is_enabled = (bool) get_post_meta( get_the_ID(), 'meta_key', true );
    
  • Add http basic auth to Pagely website

    http basic auth is handy when you want to add a username and password to stop anyone (including web crawlers) from accessing a website you’re working on, like a staging or development website.

    To add http basic auth in Pagely, go to to the Pagely Dashboard (atomic.pagely.com), go to Apps and choose the site you want to add http basic auth to.

    From there, choose the ARES tab and choose New Access Rule. Set the options you want – including the username and password – hit Save and then choose Deploy Changes.

    Anyone accessing the website in future will need to enter the username and password to proceed.

    Tip: if you’re on a Mac, you can save the username and password in Safari to save you having to re-enter it in future.

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