I’m trying to replace a string within a WordPress title. I need replace two specific keywords in the title. I don’t wish to change the title for the whole page only for this specific instance. I can’t seem to get this code to work and I’m not sure how to add addition strings to replace. Thank you for the help – I’m a PHP novice.
<?php
$wptitle = the_title();
$wptitle = str_replace('Download', '', $wptitle);?>
<?php echo $wptitle; ?>
This works: