How to use wp_list_categories() in WordPress

wp_list_categories() is a WordPress function used to display a list of categories in a WordPress website. Here are the basic steps to use wp_list_categories():

Decide where you want to display the list of categories on your WordPress website.

In the WordPress theme file where you want to display the categories, add the following code:

php
<?php wp_list_categories();?>

This will display a list of all the categories on your WordPress website.

Customize the display of the categories using the available parameters of wp_list_categories(). For example, you can customize the order in which the categories are displayed, hide empty categories, and include/exclude specific categories. Here is an example of how to customize the display of the categories:
php

 'order' => 'ASC',
'hide_empty' => true,
'exclude' => '1,5,9'
);
wp_list_categories($args);
?>

This code will display a list of categories in ascending order by name, hide any empty categories, and exclude categories with the IDs 1, 5, and 9.

Save the changes to the WordPress theme file and refresh the website to see the updated list of categories.
Note: It is important to always make a backup of your theme file before making any changes.