Random Featured Image Based on Category
First of all when you call the get_image function pass the post categories slugs as param. Edit your autoset_featured function replacing … } else { set_post_thumbnail($post->ID, get_image()); } … with: … } else { $cat_slugs = wp_get_post_terms($post->ID, ‘event-categories’, array(“fields” => “slugs”)); $image = get_image( $cat_slugs ); if ( image ) set_post_thumbnail($post->ID, $image); } … Then … Read more