How to Paste Link to WordPress Source

Paste Link to WordPress Source

A great way to protect content is to embed a link to the WordPress source. We figure out what is needed for this, and how to do it right.

Why add when copying a link?

This is one of the methods to make sure that the content of the site is not stolen. Unique content costs money. It’s a shame when it is stolen and placed for free without the consent of the author on another resource. As a result, it is difficult to prove that it was you who wrote this text.

But it is possible to complicate the work of the “copy-paste”. This will automatically add a permalink to the source page if you want to copy the text of the publication.

How to insert a link to the source in WordPress when copying text?

Consider the working methods of content protection. They differ in the implementation method but give the same result. Work for all posts, pages, and widgets.

Clearfy Pro Plugin

If you have this solution installed, in the admin panel, select Clearfy Pro, on the Advanced tab, activate the item Link to source when copying, and click the Save changes button.

Append Link on Copy Extension

After installation and activation, in the admin panel, go to the Settings > Append Link on Copy section, where in the Read more link: (like Text copied from %link% ) option, enter the desired text of the future external link.

Don’t forget to click the Save Changes button.

Also see: How to Split an Article into Multiple Pages

functions.php file

At the very end, add the PHP script:

function wpschool_add_copy_link() {
if ( !current_user_can( 'manage_options' ) ) { 
$source_text = __( '<br><br>Source: %link%' );
$source_text = str_replace('"', '\"', $source_text);
echo '<script>';
echo 'document.oncopy = function() {';
echo 'varbodyElement = document.body;';
echo 'var selection = getSelection();';
echo 'var link_url = document.URL;';
echo 'var page_link = "' . $source_text . '";';
echo 'page_link = page_link.replace("%link%", " " + link_url + " ");';
echo 'var copy_text = selection + page_link;';
echo 'vardivElement = document.createElement("div");';
echo 'divElement.style.position="absolute";';
echo 'divElement.style.left="-99999px";';
echo 'bodyElement.appendChild(divElement);';
echo 'divElement.innerHTML = copy_text;';
echo 'selection.selectAllChildren(divElement);';
echo 'window.setTimeout(function() {';
echo 'bodyElement.removeChild(divElement);';
echo '},0);';
echo '}';
echo '</script>';
}
}
add_action( 'wp_footer', 'wpschool_add_copy_link' );

Leave a comment

Your email address will not be published.