• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

Nile Flores Media

Helping You Rock Out Your Website Like A Rockstar

  • Home
  • About
  • Blog
  • Portfolio
  • Hire Me
  • Resources
  • Contact
  • Blogging
  • WordPress
  • Social Media
  • SEO
  • Web Design
  • News
  • Podcast
You are here: Home » WordPress » How to Link Twitter Usernames in WordPress Without a Plugin

How to Link Twitter Usernames in WordPress Without a Plugin

By Nile Flores Leave a Comment


Blogging and social media go hand-in-hand. Sometimes, on the fly, you need to add someone’s Twitter handle, and then grab their link. However, what if you don’t have time for that? What if you could link Twitter usernames in WordPress without a plugin? Wouldn’t that save a lot of time?

Well, you can, and this is how.

How to Link Twitter Usernames in WordPress Without a Plugin

This method is to display the at sign symbol @ and the username you want to link. This snippet of code is short and does the job for you.

It’s super simple.

Step 1. Copy the code highlighted in black.


/*
Autolink Twitter usernames in WordPress
*/
function twtreplace($content) {
$twtreplace = preg_replace('/([^a-zA-Z0-9-_&])@([0-9a-zA-Z_]+)/',"$1@$2",$content);
return $twtreplace;
}

add_filter('the_content', 'twtreplace');
add_filter('comment_text', 'twtreplace');

Step 2. Paste the code to your theme’s functions.php file.

Step 3. Just type the at sign and the Twitter username when you’re creating content on a post or page. Here’s it in action: @blondishnet

This method should work in the Gutenberg content block editor, or Classic editor. For those that like to do people roundups, or company roundups, this will save a lot of time.


Filed Under: WordPress Tagged With: link twitter username, twitter

About Nile Flores

Nile is a 43-year old female from the greater St. Louis (Southern Illinois side) area. Nile is a mother of 1 son. She is also a web designer and developer, a graphic designer, and a public speaker, who exclusively designs and develops using WordPress. She also blogs at GoDaddy's Blog, Verpex Hosting's blog and her very personal sites, Pixelled and Nail Polish Happy.




Related posts:

No related posts.

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow Me On:

  • Facebook
  • Instagram
  • LinkedIn
  • Twitter
  • YouTube

Get The Latest WordPress & Blogging Tips

Sign up for my newsletter, and also get my free ebook on 10 Reasons Why Your Website Isn't Converting, and How to Fix it!




Try to be More Positive on Social Media

Note: You can click on image and view the video in a larger lightbox window.

Footer

The Blog

Lots of free information, tutorials, and more to help you bring your best foot forward with your website.

  • Blogging
  • WordPress
  • Social Media
  • SEO
  • Web Design

Get The Latest WordPress & Blogging Tips

Sign up for my newsletter, and also get my free ebook on 10 Reasons Why Your Website Isn't Converting, and How to Fix it!

Copyright © 2025 · · WordPress