How To Add a Copyright Notice to Copied Text on WordPress


For some reason, we want to added extra copyright information, when some reader or internet user copy our content. This code using Pure JavaScript and written by Batovasan on this post. I will try to rewrite this code on this tutorial.

SO, here we go tutorial add a copyright notice to copied text on WordPress. Please notes, you need to put this code on your head.

So open your header.php and write down this code

<script type="text/javascript">
function addLink() {
	var body_element = document.getElementsByTagName('body')[0];
	var selection;
	selection = window.getSelection();
	var pagelink = "

 Read more at: "+document.location.href+"
Copyright © WordPress Tricks"; // You can change this if you want
	var copytext = selection + pagelink;
	var newdiv = document.createElement('div');
	newdiv.style.position='absolute';
	newdiv.style.left='-99999px';
	body_element.appendChild(newdiv);
	newdiv.innerHTML = copytext;
	selection.selectAllChildren(newdiv);
	window.setTimeout(function() {
		body_element.removeChild(newdiv);
	},0);
}
document.oncopy = addLink;

</script>

That’s it, now everyone that try to copy your content and paste the content on text editor new copyright notices will be follow. I hope this tricks work on you. This trick work on major modern browser excluded IE

Advertisements

3 thoughts on “How To Add a Copyright Notice to Copied Text on WordPress

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s