This depends on the context your page title is being rendered in and how the data is being fed into it.
Consider the following:
<h2><?php the_title(); ?></h2>
Solution would involve hooking to the
the_title filter and alter it in a breeze.
How about this?
<h2><?php echo $post->post_title; ?></h2> // not nice!
And it's not nice due to the problems with altering it. It's hard to know how the
$post got populated in the first place. Consider:
foreach( get_posts( ... ) as $post ):
No place to hook there, at first glance. But it can be done inside the actual posts query. Check out the
However, consider the following:
$post = $wpdb->get_row( "SELECT .... " );
Point is, depending on your situation there's probably a good solution. Check the template file, see how the title is being rendered. Fix it to be comfortable or make your plugin work a little harder.
And you will never ever be able to alter the title via a plugin if
mysql_query() is used directly to retrieve the title. Yes, I've actually seen this done. Some people go as far as hard code it in the template even. Like front-page.php will contain
<h2>Home</h2> and never even use the
$post->post_title or ever query the database.
So, depends on the context and the situation.