How to Use WordPress’ Privacy Policy System in Your Plugin

Published in WordPress.

Watch our video

There is a better version of your web

Share this post

The privacy policy of a website explains what information it collects from its visitors and why it collects that information. It is a page that you should include by law on your website.

The main problem that most website owners have is that they don’t know how to create their privacy policy exactly. Knowing the information you should include in the privacy policy can be complicated, especially when you don’t know for sure what all the plugins you use do.

If you are a WordPress plugin developer, it is in your hands to help your users and give them what they need to create their privacy policy accurately and correctly. In this post, I will explain everything you need to know for it.

Why do you need a privacy page on your website?

For starters, it’s a legal requirement in many countries (hello, GDPR!), especially if you collect information from your visitors. And you probably are, since that’s what the vast majority of the webs in the world do.

If you use Google Analytics, if you have contact forms, if you write in a blog and have the comments section open… in all these cases, when a visitor interacts with you, you will be collecting information about them. And this is something that you have to explain in your privacy policy.

What should you put in your privacy policy?

This one’s easy: you have to disclose all the data you’ll collect and the reason for doing so. You can see an example on our own website, in the Information We Collect section:

  • We explain who we are
  • We explain what information we collect from you, when we do it, and why we do it
  • We explain that we do not sell your personal data under any circumstances
  • We list the different cookies we use and the reasons why they are there
  • We explain how we comply with the GDPR
  • We list the different providers we work with and the relationship we have with them, and link to their respective privacy policies

As you can see, it is an exercise in transparency with which we give some guarantees to our visitors. But of course, we are developers and we know very well everything we use on our website, so it is relatively easy to make a truthful and correct privacy policy… but what if this is not your case?

Developer: adapt your plugin and make it compatible with the WordPress Privacy Policy System

WordPress version 4.9.6 was released in mid-2018 with a particular novelty: a system for creating privacy policies on WordPress websites. Basically, it is a system through which plugin creators can explain what data they collect and why, so that web administrators can extend their privacy policies with that information.

If you go to the Dashboard » Settings » Privacy, you will see a settings page like the following:

Privacy Settings in WordPress
Privacy Settings in WordPress.

from which you can configure your privacy policy. The most interesting part in my opinion is the link “Check out our guide”, which takes you to a page like the following:

Privacy Policy Guide in WordPress
WordPress offers a Privacy Policy Guide you can use to create your own Privacy Policy.

a draft created by WordPress’ core team with all the information WordPress collects and the reasons why it is collected. Using this draft as a basis, it is relatively simple to create your own privacy policy.

If you look at the previous screenshot, you’ll see that, in the menu on the right, there are sections that correspond to some of the plugins we have on our website, such as “Nelio A/B Testing” or “Akismet.” By clicking on “Nelio A/B Testing,” you’ll see the following:

WordPress Privacy Policy with Nelio A/B Testing Details
Nelio A/B Testing extends WordPress’ Privacy Policy System so that you can easily disclose the information it collects in your own Privacy Policy page.

which, in summary, is an explanation of all the data Nelio A/B Testing collects. In other words, our plugin is able to explain to its users what it does and why it does it, and proposes a snippet that they can copy and paste to their privacy policy and craft an accurate document.

How to integrate the plugin with the WordPress Privacy Policy System

If you want to integrate your plugin with the WordPress privacy policy, you only have to use the wp_add_privacy_policy_content function during the admin_init action. My only recommendation is that you check that the function exists before using it because if someone uses your plugin in an older WordPress installation, they’d get an error:

<?php

function nab_add_privacy_policy() {

  if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
    return;
  }

  $content  = __( 'We use Nelio A/B Testing...', 'nelio-ab-testing' );
  $content .= "\n\n";
  $content .= __( 'Nelio A/B Testing uses cookies...', 'nelio-ab-testing );

  $content = wp_kses_post( wpautop( $content ) );
  wp_add_privacy_policy_content( 'Nelio A/B Testing', $content );
}
add_action( 'admin_init', 'nab_add_privacy_policy' );

So, you see, it’s in your hands to help your users and make the web a little more transparent… what are you waiting for?

Featured image by Dayne Topkin on Unsplash.

Leave a Reply

Your email address will not be published. Required fields are marked: •

I have read and agree to the Nelio Software Privacy Policy

Your personal data will be located on SiteGround and will be treated by Nelio Software with the sole purpose of publishing this comment here. The legitimation is carried out through your express consent. Contact us to access, rectify, limit, or delete your data.