Skip to content

Commit

Permalink
config: set cookie domain
Browse files Browse the repository at this point in the history
  • Loading branch information
rpeterman-gp committed Apr 18, 2024
1 parent c778f8f commit d70e217
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions wp-config-development.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@
define( 'S3_UPLOADS_REGION', 'us-east-1' );

define( 'GRAPHQL_DEBUG', true );

define( 'COOKIE_DOMAIN', 'the-world-wp.lndo.site' );
2 changes: 2 additions & 0 deletions wp-config-production.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@
define( 'S3_UPLOADS_BUCKET_URL', 'https://media.pri.org/s3fs-public' );

define( 'WP_MEMORY_LIMIT', '512M' );

define( 'COOKIE_DOMAIN', '.theworld.org' );
2 changes: 1 addition & 1 deletion wp-content/themes/the-world/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function tw_init_set_auth_cookie() {
if ( $user && $secret_key && ! isset( $_COOKIE[ $cookie_name ] ) ) {
$hostname = wp_parse_url( get_site_url(), PHP_URL_HOST );
// NOTE: Regex assumes front-end domains will use single segment TLD's.
$domain = trim( preg_replace( '~.*?\.?((?:\.?[\w_-]+){2})$~', '$1', $hostname ), '.' );
$domain = defined( 'COOKIE_DOMAIN' ) ? COOKIE_DOMAIN : trim( preg_replace( '~.*?\.?((?:\.?[\w_-]+){2})$~', '$1', $hostname ), '.' );
$token = $auth->get_refresh_token( $user );

if ( $token && is_string( $token ) ) {
Expand Down

0 comments on commit d70e217

Please sign in to comment.