How to add a 'Read More' link to copied text in WordPress
Apr 20, 2025 am 06:00 AMYou may have noticed how some popular websites (such as eHow, etc.) attach a "Read More" link to any text copied from their website. This is a great way to get new users. People usually copy and paste text from websites into emails. Some people use it to save information for future use, while others just share it with their friends, family and colleagues. In this article, we will show you how to easily add the Read More link to any text copied in your WordPress blog for extra traffic.
Note: To see the actual effect, copy everything in this article and paste it into your email or notepad.
The first thing you need to do is copy the following code into the theme's functions.php file or site-specific plugin:
functionadd_copyright_text() { if(is_single()) { ?><script type="'text/javascript'">functionaddLink() { if(window.getSelection().containsNode(document.getElementsByClassName('entry-content')[0], true)) { varbody_element = document.getElementsByTagName('body')[0]; varselection; selection = window.getSelection(); varoldselection = selection varpagelink = "<br /><br /> Read more at WPBeginner: <?php the_title(); ?> <a href='<?php echo wp_get_shortlink(get_the_ID()); ?>'><?php echo wp_get_shortlink(get_the_ID()); ?>"; //Change this if you like varcopy_text = selection pagelink; varnew_div = document.createElement('div'); new_div.style.left='-99999px'; new_div.style.position='absolute'; body_element.appendChild(new_div ); new_div.innerHTML = copy_text ; selection.selectAllChildren(new_div ); window.setTimeout(function() { body_element.removeChild(new_div ); },0);}}document.oncopy = addLink;</script><?php }}add_action( 'wp_head', 'add_copyright_text');
Depend on
Use it with one click in WordPress
Now, whenever someone visits your website and tries to copy your content, there is a "Read More" link. Don't forget to change the copyright text and add your own website title to it.
Edit: Initially we were crawling the window URL, but as one of our users pointed out, this makes the URL look clumsy. We have updated the code to display it only on a single post page and use wp_shortlink. So it will use something like this: yoursite.com/?p=23. If you use a custom short link like ours: wpbeg.in, then it will display the brand short link.
The above is the detailed content of How to add a 'Read More' link to copied text in WordPress. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The top 20 most promising crypto assets in 2025 include BTC, ETH, SOL, etc., mainly covering multiple tracks such as public chains, Layer 2, AI, DeFi and gaming. 1.BTC continues to lead the market with its digital yellow metallicity and popularization of ETFs; 2.ETH consolidates the ecosystem due to its position and upgrade of smart contract platforms; 3.SOL stands out with high-performance public chains and developer communities; 4.LINK is the leader in oracle connecting real data; 5.RNDR builds decentralized GPU network service AI needs; 6.IMX focuses on Web3 games to provide a zero-gas-free environment; 7.ARB leads with mature Layer 2 technology and huge DeFi ecosystem; 8.MATIC has become the value layer of Ethereum through multi-chain evolution

The core difference between USDC, DAI and TUSD lies in the issuance mechanism, collateral assets and risk characteristics. 1. USDC is a centralized stablecoin issued by Circle and is collateralized by cash and short-term treasury bonds. Its advantages are compliance and transparent, strong liquidity, and high stability, but there is a risk of centralized review and single point failure; 2. DAI is a decentralized stablecoin, generated through the MakerDAO protocol, and the collateral is a crypto asset. It has the advantages of anti-censorship, transparency on chain, and permission-free, but it also faces systemic risks, dependence on centralized assets and complexity issues; 3. TUSD is a centralized stablecoin, emphasizing real-time on-chain reserve proof, providing higher frequency transparency verification, but has a small market share and weak liquidity. The three are collateral types and decentralization

Ordinary investors can discover potential tokens by tracking "smart money", which are high-profit addresses, and paying attention to their trends can provide leading indicators. 1. Use tools such as Nansen and Arkham Intelligence to analyze the data on the chain to view the buying and holdings of smart money; 2. Use Dune Analytics to obtain community-created dashboards to monitor the flow of funds; 3. Follow platforms such as Lookonchain to obtain real-time intelligence. Recently, Cangming Money is planning to re-polize LRT track, DePIN project, modular ecosystem and RWA protocol. For example, a certain LRT protocol has obtained a large amount of early deposits, a certain DePIN project has been accumulated continuously, a certain game public chain has been supported by the industry treasury, and a certain RWA protocol has attracted institutions to enter.

DAI is suitable for users who attach importance to the concept of decentralization, actively participate in the DeFi ecosystem, need cross-chain asset liquidity, and pursue asset transparency and autonomy. 1. Supporters of the decentralization concept trust smart contracts and community governance; 2. DeFi users can be used for lending, pledge, and liquidity mining; 3. Cross-chain users can achieve flexible transfer of multi-chain assets; 4. Governance participants can influence system decisions through voting. Its main scenarios include decentralized lending, asset hedging, liquidity mining, cross-border payments and community governance. At the same time, it is necessary to pay attention to system risks, mortgage fluctuations risks and technical threshold issues.

The latest version of Ouyi is v6.1271, and the update tutorial is: 1. Uninstall the old version or unofficial APK; 2. Click the official download address provided by the article to download the latest APK; 3. Enable the mobile phone installation permission; 4. Install and log in to the verification function. It is recommended to use v6.127.0 or higher. If the current version is lower than v6.124 or comes from a third-party platform, you should immediately switch to the official channel to ensure transaction security and stable functions.

In the global wave of digital asset trading, it is crucial to choose a safe, efficient and trading platform that meets your own needs. Especially for users in Asia, facing many platforms, complex functions and changing regulatory environments, how to find the best cryptocurrency platform for you and find the best cryptocurrency platform for you has become a problem for many people. This article aims to provide you with an in-depth analysis of the TOP5 cryptocurrency platforms that are most suitable for Asian users in 2025, helping you move forward steadily in the world of digital assets.

The price potential of major crypto assets from 2025 to 2030 is driven by technological development, market cycles and macroeconomics. 1. Bitcoin (BTC) is expected to break through the historical high in 2025 due to the halving event and the launch of ETFs, and may reach a new order of magnitude in 2030; 2. Ethereum (ETH) benefits from network upgrades and ecological expansion, and its long-term value is bullish; 3. Projects such as Solana, BNB, and Chainlink rely on ecological development and technological stability, and the overall market will mature but be accompanied by high risks.

Ouyi okex is a professional digital asset trading and management tool, providing users with safe, stable and reliable trading services. It supports the transaction of a variety of mainstream digital assets and provides a wealth of financial tools and products to help users easily manage and configure their own digital assets.
