Attempt to assign property “domain” on null
-
Error we are getting post removal of a multisite subsite is this error on main site
This is the error
[28-Nov-2024 23:17:19 UTC] PHP Fatal error: Uncaught Error: Attempt to assign property "domain" on null in /var/www/domain_c_usr/data/www/domain.com/wp-content/sunrise.php:22
Stack trace:
#0 /var/www/domain_c_usr/data/www/domain.com/wp-includes/ms-settings.php(47): include_once()
#1 /var/www/domain_c_usr/data/www/domain.com/wp-settings.php(155): require('...')
#2 /var/www/domain_c_usr/data/www/domain.com/wp-config.php(104): require_once('...')
#3 /var/www/domain_c_usr/data/www/domain.com/wp-load.php(50): require_once('...')
#4 /var/www/domain_c_usr/data/www/domain.com/wp-blog-header.php(13): require_once('...')
#5 /var/www/domain_c_usr/data/www/domain.com/index.php(17): require('...')
#6 {main}
thrown in /var/www/domain_c_usr/data/www/domain.com/wp-content/sunrise.php on line 22in
sunrise.php
this is about this block$wpdb->suppress_errors( false );
if( $domain_mapping_id ) {
$current_blog = $wpdb->get_row("SELECT * FROM {$wpdb->blogs} WHERE blog_id = '$domain_mapping_id' LIMIT 1");
$current_blog->domain = $dm_domain;
$current_blog->path = '/';
$blog_id = $domain_mapping_id;
$site_id = $current_blog->site_id;
define( 'COOKIE_DOMAIN', $dm_domain );
$current_site = $wpdb->get_row( "SELECT * from {$wpdb->site} WHERE id = '{$current_blog->site_id}' LIMIT 0,1" );
$current_site->blog_id = $wpdb->get_var( "SELECT blog_id FROM {$wpdb->blogs} WHERE domain='{$current_site->domain}' AND path='{$current_site->path}'" );
if ( function_exists( 'get_site_option' ) )
$current_site->site_name = get_site_option( 'site_name' );
elseif ( function_exists( 'get_current_site_name' ) )
$current_site = get_current_site_name( $current_site );
define( 'DOMAIN_MAPPING', 1 );
}I could add a check like
...
if( $domain_mapping_id ) {
$current_blog = $wpdb->get_row("SELECT * FROM {$wpdb->blogs} WHERE blog_id = '$domain_mapping_id' LIMIT 1");
// Add null check and error handling
if (!$current_blog) {
error_log("Domain mapping found but blog not found for ID: $domain_mapping_id");
return;
}
$current_blog->domain = $dm_domain;
$current_blog->path = '/';
$blog_id = $domain_mapping_id;
$site_id = $current_blog->site_id;and then I get
[29-Nov-2024 01:36:47 UTC] Domain mapping found but blog not found for ID: 44
But why would we be getting this error in the first place? With check I do see main site loading but 404 errors for all images:
[Error] Failed to load resource: the server responded with a status of 404 () (sanchichon_1280-100x100-1.jpg, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (dia-de-san-antonio-022_reduced.jpg, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (Malaga_domain_com-1.jpg, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (DSC_2435.jpg, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (Marbella_domain_com-1.jpg, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (zahara_sierra_lake-720x260-1.jpg, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (sanchichon_1280-100x100-1.jpg, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (dia-de-san-antonio-022_reduced.jpg, line 0)
[Error] Failed to load resource: the server responded with a status of 404 () (Malaga_domain_com-1.jpg, line 0)Removed check for now. So error on load.
- This topic was modified 3 months, 2 weeks ago by .
- This topic was modified 3 months, 2 weeks ago by .
- This topic was modified 3 months, 2 weeks ago by .
The page I need help with: [log in to see the link]
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- You must be logged in to reply to this topic.