Fix for "read more" comment tags in Facebook Page Publish
-
This may have something to do with how my more tag is inline amongst some other HTML, but in either case, here’s a quick fix to ensure that these do not end up posted to Facebook and that the text is cut at the right position:
Replace:
// Facebook link description allows max. 420 characters:
if (strlen($message) >= 420) {
$last_space_pos = strrpos(substr($message, 0, 417), ' ');
$message = substr($message, 0, $last_space_pos).'...';
}
With the following:
// Facebook link description allows max. 420 characters:
if (strpos($message, '<!--more-->') !== false) {
$message = substr($message, 0, strpos($message, '<!--more-->'));
}
if (strlen($message) >= 420) {
$last_space_pos = strrpos(substr($message, 0, 417), ' ');
$message = substr($message, 0, $last_space_pos).'...';
}
- The topic ‘Fix for "read more" comment tags in Facebook Page Publish’ is closed to new replies.