Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5930723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:35:35+00:00 2026-05-22T14:35:35+00:00

I have a child theme in wordpress that is based on twentyten. Some of

  • 0

I have a child theme in wordpress that is based on twentyten.

Some of my authors have hardcoded URLs in their post titles and I want to remove those URLs.

I put the following code in my functions.php file in the child theme, but it has no effect on the display of the post 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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T14:35:36+00:00Added an answer on May 22, 2026 at 2:35 pm

    strip_tags() only removes HTML tags – in your case it will change the title from

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

    to Some Text LINK Other Text

    If I understand you correctly, this is what you want:

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

    going with the above example it will output Some Text Other Text

    Note that given that you tried to accomplish the task with strip_tags(), I am assuming the “harcoded URLs”, as you described them, are enclosed in <a [...] ></a> tags. If that’s not the case you would need a regular expression that matches URLs. That is much more tricky, depending on whether the URLs your authors use are internationalized / have different domains, are not all just http:// prefaced and so on.

    I vouch for the above to work if they are enclosed in tags, if not, this regex will catch most URLs, but comes without my guarantee to work in every case:

    (([A-Za-z]{3,9})://)?([-;:&=\+\$,\w]+@{1})?(([-A-Za-z0-9]+\.)+[A-Za-z]{2,3})(:\d+)?((/[-\+~%/\.\w]+)?/?([&?][-\+=&;%@\.\w]+)?(#[\w]+)?)?

    You’d have put that between the ‘/ and /’ in the above function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wordpress site that I am using a child theme with. In
I am building a child theme in Wordpress that needs some custom functionality (for
I'm running Wordpress 3.3.1. I'm writing a child theme that modifies the default twentyeleven
I'm trying to redeclare a function in a wordpress child theme that is already
I have a child theme in wordpress and one of the plugins I am
I have a child form that is throwing an ApplicationException in the Load event
I have several child windows, all with the same parent. I want to cascade/tile
I have an <img> and some <p> 's inside a <div> . I want
I am using a custom post type in my wordpress theme, and I need
So, I'm working on a WordPress theme that uses a custom taxonomy to create

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.