How to Link Widget Titles in WordPress without using a plugin

By default WordPress does not accept hyperlinks in the widget title.  Even if you enter a hyperlink , it will strip down all the html tags  and simply print out the text.  So basically in order to link the widget titles, we’ll need to find a way to make WordPress accept html in Widget Title.

The Snippet

Here is a little snippet which lets you add a hyperlink in the widget title. The snippet  makes use of widget_title filter and it will dynamically replace custom tags with actual html tags. You can use the Code Snippet plugin to run this piece of code.

So now basically we can enter hyperlinks as [link href = http://google.com]My Widget Title[/link] in our widget title. Take note that we have entered the url without quotes. 

This little snippet will make the widget title clickable. If you are not comfortable with coding then  you can also achieve the same result by using plugins like Widget Title Links

Did you enjoy this article?
We regularly publish WordPress related Tutorials and Tips on this blog. Signup today and receive free updates straight in your inbox.
I agree to have my personal information transfered to Mad Mimi ( more information )
About Ankit

Founder of SpiceWp. We share useful Wordprss Tips and Tricks.

I have also released 17 Wordpress Plugins till date .

I regularly publish Wordpress related Tutorials and Tips on this blog.
If you like the content then consider subscribing to the blog here.

Comments

  1. Straight-forward, clean and no plugin. Very nice.

    Thanks!

  2. thanks

  3. Hi, Is there a way to apply CCS to the clickable widget title created by using the snippet above? Specifically, I need to change the text color. Thanks. Amy B.

  4. ANKIT . THANK YOU FOR POSTING ….

  5. Your work is great, but…

    How can I add the title atribute?

    Thank you very much!

  6. Thank you so much! I used to use a plugin for this, but it’s no longer maintained, so I’m thrilled to know a better way to do it.

  7. Thanks buddy. It was great to add links but I also wanted to customize the Widgets title. Like I want to add span tag for separator do you know how to do that?

  8. hell0 -the link worked, but it stripped all the visual customization of the title out. Any advice?

  9. This greatly helped me out, thank you for posting this code snippet!

Speak Your Mind

*