1 | initial version |
The error "Trying to get property of non-object" typically occurs when you are trying to access a property of an object that does not exist. There are a few solutions to eliminate this error:
if ( isset( $my_object ) ) {
$my_property = $my_object->my_property;
}
if ( ! empty( $my_object ) ) {
$my_property = $my_object->my_property;
}
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
With these constants set, you will be able to see any errors in the debug.log file in the wp-content folder of your WordPress site.