how to display all categories in wordpress?

In the code you gave us you are selected the categories selected for the specific post get_the_ID() is doing that part. However you would be best off using another function get_categories() https://developer.wordpress.org/reference/functions/get_categories/ which you would do like so: You can also pass through arguments to be more specific (if needed) – see https://developer.wordpress.org/reference/functions/get_terms/ for details … Read more