diff --git a/src/wp-includes/ms-default-constants.php b/src/wp-includes/ms-default-constants.php index 7d794e32e6523..016ed437b7146 100644 --- a/src/wp-includes/ms-default-constants.php +++ b/src/wp-includes/ms-default-constants.php @@ -68,7 +68,8 @@ function ms_cookie_constants() { * @since 2.6.0 */ if ( ! defined( 'ADMIN_COOKIE_PATH' ) ) { - if ( ! is_subdomain_install() || trim( parse_url( get_option( 'siteurl' ), PHP_URL_PATH ), '/' ) ) { + $site_path = parse_url( get_option( 'siteurl' ), PHP_URL_PATH ); + if ( ! is_subdomain_install() || is_string( $site_path ) && trim( $site_path, '/' ) ) { define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH ); } else { define( 'ADMIN_COOKIE_PATH', SITECOOKIEPATH . 'wp-admin' );