Skip to content

Commit 0b86dc9

Browse files
committed
(feat): show error when p2p_type function does not exist
1 parent 5190887 commit 0b86dc9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/Base/RestAPI/ItemFields/ConnectedField.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@ public function setSorting(
8484
*/
8585
protected function getConnectedItems(int $postID, string $type, array $extraQueryArgs = []): array
8686
{
87+
if (! function_exists('p2p_type')) {
88+
return [
89+
'error' => __('Posts 2 Posts plugin is not active', 'pdc-base'),
90+
];
91+
}
92+
8793
$connection = \p2p_type($type);
8894

8995
if (! $connection) {

0 commit comments

Comments
 (0)