Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Hur man förhindrar textval och copy and paste i WordPress (enkelt)

Senast frågade en av våra läsare oss hur de kan förhindra textval och copy and paste i WordPress?

Många publicerare som vill hindra folk från att stjäla deras content kanske vill tillämpa detta. Det gör det lite svårare för människor att kopiera text från din website.

I den här artikeln visar vi dig hur du enkelt kan förhindra textval och copy and paste i WordPress.

Preventing text selection and copying & pasting in WordPress

Varför förhindra textval och copy and paste på din site i WordPress?

Många bloggare upplever att deras content blir stulet och används utan behörighet.

Detta kan ske genom automatiserad skrapning av content. Det kan också hända om någon manuellt kopierar delar av eller hela your content.

Ett sätt att göra detta svårare är att förhindra att folk kopierar and paste din text. Det kan du göra genom att göra det svårare för dem att välja texten på din website.

Kom ihåg att tekniskt kunniga användare fortfarande kan viewa källkoden eller använda Inspect tool för att kopiera vad de vill. Dessa tekniker kommer inte heller att stoppa människor som använder auto-blogging tools för att hämta innehållet med RSS.

Med detta i åtanke ska vi nu ta en titt på några olika sätt att förhindra textval och kopiering i WordPress.

Metod 1: Förhindra val av text med hjälp av CSS

Den här metoden är enklare, och du behöver bara add to lite customize CSS-kod till ditt WordPress theme. Om du inte har gjort detta tidigare, ta då en titt på vår guide om att lägga till custom CSS på din site innan du börjar.

Först måste du besöka sidan Appearance ” Customize i WordPress admin area för att starta temat customizer.

Opening the theme customizer to add custom CSS

I theme customize måste du klicka på tabben ”Additional CSS” från den vänstra kolumnen.

Nu kommer du att se en box för att add to custom CSS till din WordPress tema. Bara copy and paste följande CSS-kod i den boxen.

* {
  -webkit-touch-callout: none; /* iOS Safari */
  -webkit-user-select: none; /* Safari */
  -khtml-user-select: none; /* Konqueror HTML */
  -moz-user-select: none; /* Old versions of Firefox */
  -ms-user-select: none; /* Internet Explorer/Edge */
   user-select: none; /* Non-prefixed version, currently supported by Chrome, Opera and Firefox */
}

(Kodkälla)

Så här ser koden ut när den har lagts till.

Adding the CSS code to prevent text selection and copy/paste

Gå nu vidare och försök att välja en del av texten på din page i live customizer. Du kommer att upptäcka att du inte kan select den.

Glöm inte att klicka på knappen ”Publicera” högst upp på vyn för att göra dina ändringar tillgängliga för alla.

Note: Med den här metoden kan du bara add to custom CSS för det aktiva temat. Om du byter tema kommer den anpassade CSS:en inte att sparas. För att din kod ska kunna saved oavsett vilket WordPress theme du använder, rekommenderar vi att du använder WPCode plugin.

Metod 2: Förhindra textval med hjälp av ett plugin

För denna metod kommer vi att använda ett plugin för WordPress som inaktiverar textval och högerklick. Detta skulle också skydda images från att downloadas och återanvändas.

Först måste du installera och aktivera WP Content Copy Protection plugin. För mer detaljer, se vår steg-för-steg guide om hur du installerar ett WordPress plugin.

Vid aktivering kommer pluginet att fungera direkt ur boxen. Användare kommer inte längre att kunna copy and paste text från din site. De kommer inte heller att kunna högerklicka eller skriva ut ditt content.

Om du vill ändra inställningarna för pluginet är det enkelt att göra det. Gå bara till sidan ”Copy Protection” i din WordPress-admin.

Här kan du välja att aktivera eller inaktivera skydd för specifika typer av content.

The settings for the WP Content Copy Protection & No Right Click plugin

Se till att du klickar på knappen ”Save Settings” när du har gjort några ändringar.

You can also change the message that will appear if someone attempts to print your content. Meddelandet kommer att visas så här i print preview och på själva utskriften.

The default message that users will see if they try to print a protected page/post

Är det en bra idé att förhindra textval i WordPress?

Många ägare till nya webbplatser vill hindra folk från att copy and paste innehåll från deras site, men dessa tekniker förhindrar inte riktigt stöld av innehåll.

Alla användare som är lite tekniskt kunniga kan enkelt öppna källkoden på din website och kopiera vilket content de vill.

Dessutom kommer inte alla som kopierar din text att vara en content-tjuv. Till exempel kanske vissa människor vill kopiera rubriken för att dela ditt post på sociala medier.

Det är därför det ej är bästa praxis att förhindra textval. Vi rekommenderar att du bara använder den här metoden om du känner att det verkligen behövs för din site.

I de flesta fall är det bättre att leta efter ett alternativt sätt att förhindra stöld av content. Om en site återpublicerar ditt content utan behörighet kan du ta reda på vem som är webbhotell och skicka ett DMCA takedown notice.

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du förhindrar textval och copy and paste i WordPress. Du kanske också vill se vår guide om hur du skapar en membership site med skyddat content, och vår jämförelse av de bästa e-postmarknadsföringstjänsterna för innehåll som endast är tillgängligt för prenumeranter.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

22 kommentarerLämna ett svar

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Dennis Muthomi says

    I have successfully added the custom CSS method on my main website, as well as three other sites I own. So far, I have not noticed any negative effects, and it provides basic protection against casual copying.
    Thanks WPBeginner.

  3. Jiří Vaněk says

    This is a great guide on how to protect your content against basic copying. I have selected CSS for my site and it seems to work great. Great and thank you. I will be applying to multiple sites.

  4. Sri Praneeth P says

    Thank you for this article. May I know if the CSS code prevents right-click only on the live website or also in the admin area?

  5. Linda says

    Thank you, this was very helpful as I’ve tried some of the plugins to stop it, but when affiliates wanted to copy their links, they could not. So I used the CSS code and that helped, thank you very much. The affiliates can copy their code but people can’t copy my content.
    Do you have an article or CSS code to stop people from copying images as well?
    Thanks again, super helpful article.

    • WPBeginner Support says

      As a tutorial site that gives codes that users can copy, it wouldn’t be helpful to our visitors if we added that code :)

      Administratör

    • WPBeginner Support says

      We do not have a specific recommendation at the moment for finding sites copying your content but we will look into the possibility of an article in the future.

      Administratör

  6. Matt says

    Option #1 can easily be overridden by looking at the HTML source of the page and copying the text that way.

    • WPBeginner Support says

      Given enough work, there are different workarounds for the ways to prevent text from being copied as the goal of a website is to share information but this is one way to help make that process more difficult.

      Administratör

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.