Why does the_title() filter is also applied in a tag / list tag?

Question

So I have a code like this below
This code is to add a prefix for the post title.
But then the prefix is also applied to list-style tag.

    function make_custom_title( $title, $id ) {
   if ( get_post_type() == 'kamus_wp') {
        $title = '<span>Apa itu:</span> ' . $title;
    }
    if ( get_post_type() == 'kamus_seo') {
        $title = '<span>Apa itu:</span> ' . $title;
    }
    return $title;
}
function set_custom_title() {
   add_filter( 'the_title', 'make_custom_title', 10, 2 );
}
add_action( 'loop_start', 'set_custom_title' );

did i miss something here?
url here

0
, Joe 2 years 2020-08-29T03:10:26-05:00 0 Answers 59 views 0

Leave an answer

Browse
Browse