Dear your code has a small error.
There is an extra ‘)’ on line 6 after $categories
add_filter('wpseo_sitemap_entry', 'exclude_post_in_categories', 10, 3);
function exclude_post_in_categories($url, $type, $post ) {
// Add the category's slugs you want to exclude to this array
$categories = array('category-slug-1', 'category-slug-2', 'and-so-on');
if(has_category($categories, $post->ID)) {
return false;
}
return $url;
}
Hi,
Try this plugin it will solve your problem 🙂
Just activate it and you are done.
https://wordpress.org/plugins/wonderm00ns-simple-facebook-open-graph-tags/
This plugin will show the image you set as featured automatically when someone share that post on social media.
What actually required is setting up Open Graph Meta Tags
This tag particularly.
<meta property="og:image" content="image-url-goes here" />
The plugin you mentioned “wordpress auto featured image” is for setting a default image for the posts a user doesn’t add a thumbnail. It doesn’t add any Open Graph meta tags.