wordpress 文字数制限 PHP mb_strimwidth

1
2
3
4
5
6
//抜粋文の文字制限
add_filter('the_excerpt', 'my_the_excerpt');
function my_the_excerpt($postContent) {
    $postContent = mb_strimwidth($postContent, 0, 140, "…","UTF-8");
    return $postContent;
}