get total post in category via ajx
The code in your question uses the old admin AJAX API, and while I would normally advise you switch to the REST API, or fix the AJAX you already have, neither are necessary. WordPress already provides an endpoint that contains the post count and other information! https://<yoursite>/wp-json/wp/v2/categories/<category ID> E.g. on my own site the category … Read more