mirror of
https://hk.gh-proxy.com/https://github.com/wp-cli/profile-command.git
synced 2025-08-21 06:39:02 +08:00
Trailingslash provided URL to avoid canonical redirect
This commit is contained in:
parent
8fe2681eef
commit
ee16b7982a
1 changed files with 6 additions and 4 deletions
|
@ -267,11 +267,13 @@ class Command {
|
||||||
* Run the profiler against WordPress
|
* Run the profiler against WordPress
|
||||||
*/
|
*/
|
||||||
private function run_profiler() {
|
private function run_profiler() {
|
||||||
if ( ! isset( WP_CLI::get_runner()->config['url'] ) ) {
|
WP_CLI::add_wp_hook( 'muplugins_loaded', function(){
|
||||||
WP_CLI::add_wp_hook( 'muplugins_loaded', function(){
|
if ( $url = WP_CLI::get_runner()->config['url'] ) {
|
||||||
|
WP_CLI::set_url( trailingslashit( $url ) );
|
||||||
|
} else {
|
||||||
WP_CLI::set_url( home_url( '/' ) );
|
WP_CLI::set_url( home_url( '/' ) );
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
WP_CLI::add_hook( 'after_wp_config_load', function() {
|
WP_CLI::add_hook( 'after_wp_config_load', function() {
|
||||||
if ( defined( 'SAVEQUERIES' ) && ! SAVEQUERIES ) {
|
if ( defined( 'SAVEQUERIES' ) && ! SAVEQUERIES ) {
|
||||||
WP_CLI::error( "'SAVEQUERIES' is defined as false, and must be true. Please check your wp-config.php" );
|
WP_CLI::error( "'SAVEQUERIES' is defined as false, and must be true. Please check your wp-config.php" );
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue