Can’t see anything deprecated, but I have spotted these:
-
category_name
expects (confusingly) the category slug, so the value should (most likely) beprovider-news
and notProvider News
-
If you’re using
setup_postdata
it’s best to also manually set the global$post
too to ensure interoperability of template functions – just putglobal $post;
inside the start of yourwpb_postsbycategory2022
function. -
The line
wp_reset_postdata()
is after a return statement at the end of the function, so it will never be called! Move thereturn $output_string;
line to the very end of your function.