Strip $before & $after strings from a page title

There is no filter that would allow you to strip those $before and $after values:

42    function the_title($before="", $after="", $echo = true) {
43            $title = get_the_title();
44    
45            if ( strlen($title) == 0 )
46                    return;
47    
48            $title = $before . $title . $after;
49    
50            if ( $echo )
51                    echo $title;
52            else
53                    return $title;
54    }

https://core.trac.wordpress.org/browser/tags/3.8.1/src/wp-includes/post-template.php#L42

That is the end of the story. To change that you need to hack the theme. What you want, “to do this from within the plugin and without creating a custom page template so it will work with any theme”, isn’t possible.

At best you could write output buffering into the theme, but again, you’d need to hack the theme.

Even if it were possible, you would like cause numerous and sometimes catastrophic failure in the theme, as you would be removing markup that the theme may depend upon. What you want is a bad idea, sorry.

error code: 523