Skip to content

Commit e938e2c

Browse files
Handle old autoloaded version of the plugin not having the new method
1 parent c187cc7 commit e938e2c

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

php/relate/class-relationship.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,9 @@ public function get_data() {
7979
return $cache_data;
8080
}
8181
global $wpdb;
82-
$table_name = Utils::get_relationship_table();
83-
$default_contexts = Utils::get_media_context_things();
82+
$table_name = Utils::get_relationship_table();
83+
// method_exists guard handles the case where Utils was autoloaded from the old plugin version during a plugin update request.
84+
$default_contexts = method_exists( Utils::class, 'get_media_context_things' ) ? Utils::get_media_context_things() : array( 'default' );
8485

8586
// If the context is in the default contexts, we want to query for all of them.
8687
// This ensures that a media uploaded with a previous default context will still be found, even if the default context has changed since it was uploaded.

0 commit comments

Comments
 (0)