function titleLimitChar($title){ if(strlen($title) > 55 && !(is_single()) && !(is_page())){ // not in single post page and page. $title = substr($title,0,55) . ".."; } return $title; } add_filter( 'the_title', 'titleLimitChar' );
![](https://i0.wp.com/arjunphp.com/wp-content/uploads/2023/11/wordpress-limit-character-in-the-post-title_1878.jpg?fit=800%2C400&ssl=1)
Tutorials focused on Web Development, ReactJS, JavaScript, PHP, Database Design, Devops
function titleLimitChar($title){ if(strlen($title) > 55 && !(is_single()) && !(is_page())){ // not in single post page and page. $title = substr($title,0,55) . ".."; } return $title; } add_filter( 'the_title', 'titleLimitChar' );