[英]Wordpress <?php the_content(); ?> without the “Read More” link
[英]how to remove read more after call the_content function in wordpress?
我想在調用wordpress的the_content()函數后刪除更多鏈接。 我只想在循環中顯示每個帖子的內容,閱讀鏈接是多余的。
我嘗試使用此代碼,但帖子內容后仍保留更多閱讀鏈接:
add_filter( 'the_content_more_link', 'disable_more_link', 10, 2 );
function disable_more_link( $more_link, $more_link_text ) {
return;
}
在哪里可以找到在內容后添加此閱讀鏈接的代碼?
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 );
function new_excerpt_more($more) {
return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.