I've got a child theme in wordpress that's according to twentyten.

A number of my authors have hardcoded Web addresses within their publish game titles and I wish to remove individuals Web addresses.

I place the following code during my functions.php file within the child theme, however it doesn't have impact on the display from the publish title:

add_filter( ‘the_title’, ‘ib_strip_tags_from_titles’ );
function ib_strip_tags_from_titles( $title ) {
  $title = strip_tags( $title );
  return $title;

Any suggestions?

strip_tags() only removes HTML tags - inside your situation it'll alter the title from

Some Text <a href="http://someurl.com">LINK</a> Other Text

to Some Text LINK Other Text

Basically understand you properly, this is exactly what you would like:

function ib_remove_links_from_titles($title) {
    $title = preg_replace('/<a([^<]*)">([^<]*)<\/a>/', '', $title);
    return $title;
add_filter( 'the_title', 'ib_remove_links_from_titles' );

choosing the above mentioned example it'll output Some Text Other Text

Observe that considering that you attempted to get the job done with strip_tags(), I'm presuming the "harcoded Web addresses", while you referred to them, are enclosed in <a [...] ></a> tags. If that is not the situation you'd require a regular expression that suits Web addresses. That's a lot more tricky, based on if the Web addresses your authors use are internationalized / have different domain names, aren't all just http:// prefaced and so forth.

I attest to the above mentioned to operate if they're enclosed in tags, otherwise, this regex will catch most Web addresses, but comes without my guarantee to operate in each and every situation:


You'd have put that between your '/ and /' within the above function.