将类别链接更改为指向“#”而不是类别

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

我似乎无法正确调整以下代码以将类别链接指向“#”而不是指向类别页面。任何建议将不胜感激!

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;

你可以试试:

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

strip_tags() 是一个 PHP 函数,它将删除 get_the_category_list WP 函数返回的所有标签。