The LnkBio plugin has a function that hooks into the 'wp_insert_post' action. That function calls unset($post->post_content) on the WordPress $post object. Theoretically, this shouldn’t unset the post’s post_content attribute outside of the LnkBio function, but when I test this locally (mocking the LnkBio plugin’s API calls), the call to unset($post->post_content) is unsetting the post content for the WP Discourse plugin here: wp-discourse/lib/discourse-publish.php at main · discourse/wp-discourse · GitHub.
This only happens when posts are published with the Classic Editor. If posts are published with the Block Editor, the post content is available to the WP Discourse plugin. I’m assuming this is because posts published with the Block editor are published via a REST request.
Note that I’m running into the issue of no content being published to Discourse both when I set a custom excerpt length and when I select the WP Discourse “Use Full Post Content” option.
The easiest fix would be to switch over to using the Block editor.
Another option would be to contact LnkBio and tell them about the issue. They could fix this by finding a safer way of parsing the post content for their API request:
function lnkbio_api_sync($post_id, $post, $update) {
unset($post->post_content);
if ($post->post_status === 'publish') {
if (!get_option('lnkbio_id') || !get_option('lnkbio_secret')) {
return;
}
// url set to `example.com` for testing without a lnkbio account
wp_remote_post(
'http://example.com',
[
'blocking' => false,
'body' => [
'ACTION' => 'WP_sync',
'post_id' => $post_id,
'post' => json_encode($post),
'id' => get_option('lnkbio_id'),
'secret' => get_option('lnkbio_secret'),
'permalink' => get_permalink($post),
'is_pub' => true,
'image' => get_the_post_thumbnail_url($post_id, 'full'),
'group_id' => get_option('lnkbio_group'),
]
]
);
}
}
Edit: you could also just edit the LnkBio plugin’s code to remove the call to unset($post->post_content); and then finding a way of setting the appropriate values for the $post object that’s used here:
'post' => json_encode($post)
Generally editing plugins in this way is a bad idea, but it would work if you are very careful. Probably only do this if you have a way of testing your changes on a non-production site.