Link WordPress Widget Titles: 4 Easy Ways
You can add a link to a WordPress widget title by editing the widget’s HTML directly, using a plugin, or adding a small code snippet to your theme’s functions.php file. The method you choose depends on whether you want a quick no-code fix or a permanent solution that works across all widgets. Below are four reliable ways to make your widget titles clickable, with steps for each.
Why Link a Widget Title?
Widget titles are usually plain text, but making them clickable improves navigation and can boost engagement. For example, a “Recent Posts” widget title could link to your blog archive, or a “Featured Offer” title could link to a sales page. This is especially useful for sidebar widgets, footer widgets, and homepage sections where you want to guide visitors without adding extra buttons.
WordPress does not natively support linking widget titles. The title field in the widget editor only accepts plain text. To add a link, you must either modify the widget’s output or use a workaround. The good news is that there are several straightforward methods, ranging from beginner-friendly to more advanced.
Method 1: Edit the Widget HTML Directly (Block Widgets)
If you use the default block-based widget editor (introduced in WordPress 5.8), you can wrap the title in a link using the HTML block. This works for any widget that allows an HTML block inside it.
- Go to Appearance → Widgets.
- Click the block inserter (+) and add an HTML block where you want the title.
- Enter your linked title as HTML, for example:
<a href="/archives">Recent Posts</a>. - Place this HTML block above the widget content (e.g., above the recent posts list).
- Save the widget.
This method gives you full control over the link and its styling. However, it only works for block-based widgets, not for classic widgets that use the old editor.
Method 2: Use a Plugin for Classic Widgets
If you are still using the classic widget editor (or your theme uses classic widgets), a plugin is the easiest solution. Several free plugins add a “Link URL” field to every widget title. One popular option is Widget Title Links or Easy Widget Title Link. After installing and activating such a plugin:
- Go to Appearance → Widgets.
- Open any widget’s settings.
- You will see an extra field labeled Title Link URL (or similar).
- Enter the URL you want the title to point to.
- Save the widget.
Plugins are ideal for non-coders because they integrate seamlessly and work with both classic and some block widgets. Be sure to choose a plugin that is actively maintained and compatible with your WordPress version.
Method 3: Add a Code Snippet to functions.php
For a lightweight, theme-level solution, you can add a filter to your theme’s functions.php file. This method works for classic widgets and gives you complete control. The code below makes any widget title that contains a specific marker (like |) split into a link.
add_filter( 'widget_title', 'my_linked_widget_title', 10, 3 );
function my_linked_widget_title( $title, $instance, $id_base ) {
// Only if title contains a pipe separator
if ( strpos( $title, '|' ) !== false ) {
$parts = explode( '|', $title );
$title = '<a href="' . esc_url( $parts[1] ) . '">' . esc_html( $parts[0] ) . '</a>';
}
return $title;
}
Then, in your widget title field, enter:My Title|https://example.com
The title will display as “My Title” and link to the URL after the pipe. This method requires editing theme files, so always use a child theme and back up your site first. If you are not comfortable with code, use a plugin instead.
Method 4: Use a Custom HTML Widget
If you want a linked title without affecting other widgets, you can simply replace the widget with a Custom HTML widget. This is a built-in WordPress widget that lets you paste any HTML, including a linked heading.
- Add a Custom HTML widget to your sidebar or footer.
- Paste your linked title HTML, e.g.,
<h2><a href="/specials">Special Offers</a></h2>. - Then add your actual widget content below it (e.g., a shortcode or another widget).
This approach is simple and works in any WordPress version, but it requires you to manually style the heading to match your theme’s widget titles.
Common Problems and How to Fix Them
- Link not appearing: If you used a plugin and the link doesn’t show, clear your cache and check that the plugin is active. Also, some themes override widget titles with their own filters.
- Broken links: Always use full URLs (including
https://) to avoid relative path issues. - Styling issues: The linked title may not look like a link (no underline or color change). Add custom CSS, e.g.,
.widget-title a { color: #0073aa; }. - Code not working: If you added the code snippet and nothing changed, check for syntax errors and ensure you are editing the correct theme’s functions.php (use a child theme).
Which Method Should You Choose?
Your choice depends on your comfort level and the type of widgets you use:
- Block widgets: Use the HTML block method (Method 1) – no extra plugins needed.
- Classic widgets and non-coders: Use a plugin (Method 2) – fastest and safest.
- Developers: Use the code snippet (Method 3) – lightweight and reusable.
- Single widget: Use a Custom HTML widget (Method 4) – quick and isolated.
All methods are safe as long as you back up your site before making changes. If you are using a page builder like Elementor or Beaver Builder, check their widget settings first – many page builders have a built-in “Title Link” option.
Frequently Asked Questions
Can I link a widget title without a plugin?
Yes. You can use the HTML block method (for block widgets) or add a code snippet to your theme’s functions.php. Both are plugin-free and give you full control.
Will linking a widget title affect SEO?
Linking a widget title can help SEO if the link points to a relevant page and uses descriptive anchor text. However, widget titles are often in sidebars or footers, which have lower SEO weight than main content. It’s still good practice to use meaningful links.
Does this work with all WordPress themes?
Yes, the methods work with any theme, but the styling may differ. Some themes have custom widget title classes, so you may need to adjust CSS to make the link look consistent.
What if I only want to link one widget title?
Use the Custom HTML widget method (Method 4) – it’s the simplest and doesn’t affect other widgets.
Is it safe to edit functions.php?
Editing functions.php is safe if you use a child theme and make a backup. A syntax error can break your site, so always test the code locally or use a plugin that provides a code snippet manager with error checking.
Can I link a widget title to open in a new tab?
Yes. Add target="_blank" to the anchor tag in any method. For example: <a href="https://example.com" target="_blank">My Title</a>.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.