How to get a custom taxonomy slug in body classes

To add the custom taxonomy slug to the body classes of your WordPress site, you can use the body_class filter along with your custom code. Below is your example of how you can achieve this:

function themeprefix_add_taxonomy_class($classes) {
    global $post;
    if (is_page()) {
        $taxonomy = 'page_section';
        $terms = get_the_terms($post->ID, $taxonomy);

        if ($terms && !is_wp_error($terms)) {
            foreach ($terms as $term) {
                $classes[] = 'section-' . $term->slug;
            }
        }
    }
    return $classes;
}
add_filter('body_class', 'themeprefix_add_taxonomy_class');

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)