Here is the solution I found.
Line 255-285 is
foreach($fb_mentioned_friends as $friend) {
try {
if ($post_thumbnail_url == null) {
$args = array('link' => apply_filters( 'rel_canonical', get_permalink()),
'name' => get_the_title(),
'caption' => apply_filters( 'the_excerpt', get_the_excerpt() ),
'description' => apply_filters( 'the_excerpt', get_the_excerpt() ),
'message' => $mentioned_friends_message,
);
}
else {
$args = array('link' => apply_filters( 'rel_canonical', get_permalink()),
'picture' => $post_thumbnail_url,
'name' => get_the_title(),
'caption' => apply_filters( 'the_excerpt', get_the_excerpt() ),
'description' => apply_filters( 'the_excerpt', get_the_excerpt() ),
'message' => $mentioned_friends_message,
);
}
$args['ref'] = 'fbwpp';
$publish_result = $facebook->api('/' . $friend['id'] . '/feed', 'POST', $args);
$publish_ids_friends[] = sanitize_text_field($publish_result['id']);
}
catch (FacebookApiException $e) {
}
}
I surrounded it with this
if(!empty($fb_mentioned_friends)){
}
Line 297-328 is
foreach($fb_mentioned_pages as $page) {
try {
if ($post_thumbnail_url == null) {
$args = array('link' => apply_filters( 'rel_canonical', get_permalink()),
'name' => get_the_title(),
'caption' => apply_filters( 'the_excerpt', get_the_excerpt() ),
'description' => apply_filters( 'the_excerpt', get_the_excerpt() ),
'message' => $mentioned_pages_message,
);
}
else {
$args = array('link' => apply_filters( 'rel_canonical', get_permalink()),
'picture' => $post_thumbnail_url,
'name' => get_the_title(),
'caption' => apply_filters( 'the_excerpt', get_the_excerpt() ),
'description' => apply_filters( 'the_excerpt', get_the_excerpt() ),
'message' => $mentioned_pages_message,
);
}
$args['ref'] = 'fbwpp';
$publish_result = $facebook->api('/' . $page['id'] . '/feed', 'POST', $args);
$publish_ids_pages[] = sanitize_text_field($publish_result['id']);
}
catch (FacebookApiException $e) {
}
//$mentions .= $page['id'] . ",";
}
I just surrounded that with this
if(!empty($fb_mentioned_pages)){
}
I’m not sure if this is going to help anything, but it got rid of the error and the posting is working fine.