elementor / wp2static

WordPress static site generator for security, performance and cost benefits
https://wp2static.com
The Unlicense
1.42k stars 266 forks source link

support non-standard crawl ports #511

Open leonstafford opened 4 years ago

leonstafford commented 4 years ago

had been earmarked for Advanced Crawling Add-on, but based on following workaroud by @john-shaffer, it may be possible to avoid add-on by adding some logic like John's

ie, reproduce issue and investigate better handling of Site URL/Home's port when they've been set via wp-config.php

// wp-config.php
if ( defined( 'WP_CLI' ) ) {
    $_SERVER['HTTP_HOST'] = 'localhost:1234';
}

define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/');
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/');
john-shaffer commented 4 years ago

Note that this only works consistently if you also set

define('DISABLE_WP_CRON', true);

and set up a cron job such as wp cron event run --due-now. Otherwise you get wp-cron activations from page visits, which will have the non-localhost HTTP_HOST.