WordPress 6.0 upgrade caused my custom function to stop working

Can’t see anything deprecated, but I have spotted these:

  1. category_name expects (confusingly) the category slug, so the value should (most likely) be provider-news and not Provider News

  2. If you’re using setup_postdata it’s best to also manually set the global $post too to ensure interoperability of template functions – just put global $post; inside the start of your wpb_postsbycategory2022 function.

  3. The line wp_reset_postdata() is after a return statement at the end of the function, so it will never be called! Move the return $output_string; line to the very end of your function.