Can someone help me with WordPress capitalisations code?

it might work
Code:
add_filter( 'the_title', 'h1_capital', 10, 2 );
function h1_capital( $title, $id = null ) {
 
    return ucwords(strtolower($title));
}

add_filter( 'the_content', 'replace_capital', 1); 
function replace_capital($content){
    $content = preg_replace_callback('#<h([2-6])>(.*?)<\/h[2-6]>#si', function($m) {
          return '<h' . $m[1] . '>' . ucfirst(strtolower($m[2])) . '</h' . $m[1] . '>';
    }, $content);
    return $content;
}
 
I have Codephobia dears - this not fun to read.

Greets
 
Back
Top