please how can i fix this error in my site, please can anyone help
Please leave your website URL to allow us check it. And provide an example.
You don't have any image in topics and posts so it selects first found image from your website. This is normal. wpForo detects images in topic first post content when you try to share a topic and it sets found first image as share image. Here is a good topic to see that in action: https://wpforo.com/community/general-discussions/sharing-wpforo-links-on-linkedin/
For non-topic (forum home, forums and other) pages and for topics without an image wpForo allows to set default share image. That's the default share image (og:image share tag) . You should put this code in WordPress theme functions.php file to set it. Just change the red marked image URL to your website/forum logo URL or to something else, it'll be the default share image:
function my_default_og_image( $image_url, $type ){
if( $type == 'og:image' && !$image_url){
return 'https://example.com/images/mylogo.jpg';
}
else{
return $image_url;
}
}
add_filter('wpforo_find_image_url', 'my_default_og_image', 10, 2);
How to Easily Add Custom Code in WordPress (without Breaking Your Site)
Searching through the help forum and ran across this topic.
Is there a way to share a specific image from a post to Twitter/Facebook, or only the default option above?
function my_default_og_image( $image_url, $type ){
if( $type == 'og:image' && !$image_url){
return 'https://example.com/images/mylogo.jpg';
}
else{
return $image_url;
}
}
add_filter('wpforo_find_image_url', 'my_default_og_image', 10, 2);
I entered this into my child theme (after changing the image example to my own) and it doesn't work. Any ideas?