Changing category links to point to '#' instead of category

63 views Asked by At

I can't seem to correctly adjust the below code to direct the category links to point to '#' instead of pointing to the category page. Any suggestions would be greatly appreciated!

if ( ! function_exists( 'theme_framework_post_cat' ) ) :
function theme_framework_post_cat() {
  if ( 'post' == get_post_type() ) {
    $categories_list = get_the_category_list( esc_html__( ', ', 'theme' ) );
    if ( $categories_list && theme_framework_categorized_blog() ) {
        printf( '<span class="cat-links">' . esc_html__( '%1$s', 'theme' ) . '</span>', $categories_list );
    }
  }
}
endif;
1

There are 1 answers

2
Poldira On BEST ANSWER

You can try:

$categories_list = strip_tags(get_the_category_list( esc_html__( ', ', 'theme' ) ));

strip_tags() is a PHP function that will remove all the tags that are returned by the get_the_category_list WP function.