Navid_pdp11
Navid_pdp11

Reputation: 4012

how to remove read more after call the_content function in wordpress?

I want to remove read-more link after calling the_content() function of wordpress. I want only to show content of each post in a loop and read-more link is redundant.

I try this code but read-more link remains after post content:

add_filter( 'the_content_more_link', 'disable_more_link', 10, 2 );

function disable_more_link( $more_link, $more_link_text ) {
    return;
 }

where I can find the code that adds this read-more link after the content?

Upvotes: 0

Views: 760

Answers (2)

Ravi Patel
Ravi Patel

Reputation: 5211

More info

function new_excerpt_more($more) {
    return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');

Upvotes: 0

Gufran Hasan
Gufran Hasan

Reputation: 9373

    You can use a filter to remove the read-more link from content. I have updated your filter. Please try it, It's working fine.

    function disable_more_link( $link ) {
        $link = preg_replace( '|#more-[0-9]+|', '', '' );
        return $link;
    }
   add_filter( 'the_content_more_link', 'disable_more_link', 10, 2 );

Upvotes: 2

Related Questions