How to customise a Privacy Policy Guide
Let me clarify βΒ WordPress 4.9.6 didn’t receive any functionality to change the content of your existing Privacy Policy pages on the fly. And I do not recommend to do it automatically. Well, if you want it so much, the_content()
action hook will help you. Maybe π
So, what is the new functionality about? First of all a new Privacy submenu item appeared in the Settings menu. You can create or select any existing privacy page and after that its ID will be available in options, get_option( 'wp_page_for_privacy_policy' )
.

Do you see “Check out our guide” link? This tutorial is all about it. The guide contains the recommended content for your Privacy Policy page, you can copy it the whole, or just some parts and insert to your Privacy Policy page manually. Plugin authors can add their plugin-related sections to the guide with wp_add_privacy_policy_content()
function.
Change the default content in the Privacy Policy Guide
WordPress has a lot of default content in this admin section. But sometimes you may want to customize it to meet your custom theme needs.
Here is how to do it.
add_filter( 'wp_get_default_privacy_policy_content', 'misha_custom_privacy_content' );
function misha_custom_privacy_content( $privacy_content ){
return wpautop('Who I am
I\'m Misha.
How I collect you data
I don\'t.');
}
Here is what we got after inserting the above code in… let’s say functions.php
of your theme.

And yes, no way to change the Introduction.
Add a section to Privacy Policy Guide
As I already mentioned before, wp_add_privacy_policy_content()
function can help you with it. Note, that you have to run it within admin_init
action hook and do not forget to make it compatible with WordPress 4.9.5 and lower.
add_action( 'admin_init', 'misha_custom_plugin_privacy_content' );
function misha_custom_plugin_privacy_content() {
// compatibility with old WordPress versions to avoid error 500
if ( ! function_exists( 'wp_add_privacy_policy_content' ) ) {
return;
}
wp_add_privacy_policy_content(
'Plugin by Misha', // section name
'When you contact us via a contact form, your email will be stored in database for a one week. So we never miss your email!' // content
);
}
So, once you added it, you could notice, that a notification bubble has been appeared near the Settings Menu.

Go to Settings > Privacy and click "Check out our guide" link.
I wrap the text into wpautop()
WP function just to auto-<p> it. And here is what we got.

Here is a short video about this functionality as well:
[youtube_embed]https://www.youtube.com/embed/KHgZerh7nKY[/youtube_embed]
If you have any questions, welcome to comments π

Misha Rudrastyh
Hey guys and welcome to my website. For more than 10 years I've been doing my best to share with you some superb WordPress guides and tips for free.
Need some developer help? Contact me
Hello Misha,
Please post some content about AJAX. Some of your followers are always waiting for Ajax. In past your work was fabulous.
Thanks
Hello,
Ahh, ok π
But what exactly? Have any ideas?
Hello,
Yes it will be Ajax Live Search for (Post, Page, CPT, & taxonomies).
In past i worked on Search but unfortunately unable to get all 4 in one place.
Thanks
I do not plan to publish a tutorial about AJAX search, could you suggest anything else?
Load (HTML or Script) with buttons into div. Each button represents a separate meta box with its name.
Ok, thank you for the suggestion!
I’m going to publish the next tut about AJAX π π
Waiting………
Hi Misha
I read all your tutorials and you have done always Fabulous job. can you please create one demo for Ajax pagination for Default post and Custom post type.
make sure i am not talking about load more.
Thanks
Ahir
Hi Ahir,
Ok, thank you for the idea.