Do you want to add a read more link to your content whenever someone copy text from your website or blog? Then you came at the right place.
Here we’ve posted the guide of copied the link that will attach “Read more at YourWebsiteName” link to any text that is copied from your website. It is a great way to get new users whenever your friend or other people copy pasting text from your website into WhatsApp, Facebook, Twitter, Notepad. In this article, we are going to show you how you can easily add a “read more” link to any copied text from your WordPress blog, so you can get additional traffic.
In this article, we are going to show you how you can easily add a “read more” link to any copied text from your WordPress blog, so you can get additional traffic or backlink if they posted to forums or on their website.
2 Code Snippets for Add a Read More Link to Copied Text
There is 2 format of adding read more link to the copied content. Let’s take a look.
1: Add Read More Link Copied Text. (Formatted Text)
The below code will add a link and when someone copied the article it will add read more with the link to the post. It will display the copied text as formatted as it was displaying on the website.
Steps to Use Read More Link Code
- Copy the below code.
- Open your theme’s functions.php file.
- Paste the below code.
- Save
- View the result in the browser by copy some text from your website.
- And paste it anywhere.
2: Add Read More Link Copied Text. (Unformatted Text)
The below code will help you to add a read more link and unformatted the design and gap of a paragraph. This is the common issue.
Follow the above steps to use the below code.
Hope this code works like a charm for you. If you guys have any questions please let me know in the comment question. Don’t forget to say thanks, if it was useful for you.
Thank you, the code not work if anyone open and copy a text in a tag post and in a page.
If i have an article named “Benefist of travel” and i tag it Travel benefits, if some user access the tag travel benefits and copy text from there, the code you posted not will work.
Also the code don’t work on a page with text, only on post/article.
Thanks Marius.
The above code we only made for the Posts and not for the all pages.
So If you want this code work for all over your website, Just remove the code from Line No: 10
if (is_single()) {
” and also remove closing}
from line no: 41Have a great day!
Hello Thanks for reply Hunk but unfortunately if i remove the code if (is_single()) { and } from line no: 41
when i copy paste return exemple p=27252 instead of completly name of post-article-tag or page.
I have tested the codes and it’s working for me.
There might be something you are missing or some wordpress related issue.
Can you just removed old codes and use this one https://gist.github.com/hunkriyaz/22be460cd4c17c0b50e167dcbff76302
and if it still showing any error, try to set Permalink structure to the one you use again and save settings.
Let me know, if you it not fixed the issue.
Thank you for answer, when i use the new code at github link i got back an error on functions.php
syntax error, unexpected ‘<', expecting end of file
I forget to mention that, do not copy the
tag. Just copy from line no: 2 to 33
Wonderful Hunk Riyaz! Now Work Perfect and able too see the sources for a page for every link tag pages etc with the proper name. Thank you so much for your time and help!
Merry Christmas!
Hello Hunk Riyaz,
I just loved this post. I can’t explain how helpful it was to me.
I was looking for the code which could preserve the HTML format and my search ended here.
I am not using it with is_single rather I’ve added the code in footer without php if condition and it working Awesome!
I would like to thank you very much from the core of my heart.
Tejinder Singh
How can we disable this feature when admin is logged-in? Thanks!