WP_Privacy_Policy_Content::get_default_content( bool $description = false, bool $blocks = true ): string
- Since
- 4.9.6, 5.0.0
- Source
wp-admin/includes/class-wp-privacy-policy-content.php:458
Compatibility
- WordPress
- since 5.0.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$descriptionbooloptional- Whether to include the descriptions under the section headings. Default false.Default:
false $blocksbooloptional- Whether to format the content for the block editor. Default true.Default:
true
Return value
string- The default policy content.
Performance profile
How much work a call to WP_Privacy_Policy_Content::get_default_content() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Heavy
- Scaling
- Scales with input
- Instructions
- 211–341
- Plugin surface
- 1 hook
- Called by
- 2
Reads stored settings via get_option(), cached per request but not free on a cold cache.
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 505.
Third-party callbacks on 'wp_get_default_privacy_policy_content' run inside this call, and their cost is not bounded by anything here.
2 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters_deprecated()called directly - optionoption read or write
get_option()one call below WP_Privacy_Policy_Content::get_default_content()
Further down the call graph this can also reach cache, serialize, query and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 18 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Privacy_Policy_Content::get_default_content() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
| always | 211–216 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 218–223 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 225–231 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 232–238 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 240–246 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 247–253 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 255–261 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 262–268 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 270–276 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 277–283 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 285–291 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 292–298 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
6 further outcomes, up to 341 instructions
| always | 300–305 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 307–313 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 315–320 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 322–329 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 331–336 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
| always | 338–341 | __(), __(), __(), get_bloginfo(), sprintf(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __(), __() |
This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 505 | 211–341 | 25 | |
| 8.5 | 505 | 211–341 | 25 | |
| 8.4 | 505 | 211–341 | 25 | 10 fewer instructions than PHP 8.3 |
| 8.3 | 515 | 215–345 | 25 | |
| 8.2 | 515 | 215–345 | 25 | |
| 8.1 | 515 | 215–345 | 25 | |
| 7.4 | 515 | 215–345 | 25 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 1
One hook fires while WP_Privacy_Policy_Content::get_default_content() runs, in this order:
- do_action( wp_get_default_privacy_policy_content )filter_deprecatedline 689 (+231 into the body)
Filters the default content suggested for inclusion in a privacy policy.
Uses · 4
- __()Retrieves the translation of $text.
- get_bloginfo()Retrieves information about the current site.
- str_starts_with()Polyfill for `str_starts_with()` function added in PHP 8.0.
- apply_filters_deprecated()Fires functions attached to a deprecated filter hook.
Used by · 2
- WP_Privacy_Policy_Content::add_suggested_content()Adds the suggested privacy policy text to the policy postbox.
- wp_install_defaults()Creates the initial content for a newly-installed site.
Source code
public static function get_default_content( $description = false, $blocks = true ) { $suggested_text = '<strong class="privacy-policy-tutorial">' . __( 'Suggested text:' ) . ' </strong>'; $content = ''; $strings = array(); // Start of the suggested privacy policy text. if ( $description ) { $strings[] = '<div class="wp-suggested-text">'; } /* translators: Default privacy policy heading. */ $strings[] = '<h2 class="wp-block-heading">' . __( 'Who we are' ) . '</h2>'; if ( $description ) { /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should note your site URL, as well as the name of the company, organization, or individual behind it, and some accurate contact information.' ) . '</p>'; /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'The amount of information you may be required to show will vary depending on your local or national business regulations. You may, for example, be required to display a physical address, a registered address, or your company registration number.' ) . '</p>'; } else { /* translators: Default privacy policy text. %s: Site URL. */ $strings[] = '<p>' . $suggested_text . sprintf( __( 'Our website address is: %s.' ), get_bloginfo( 'url', 'display' ) ) . '</p>'; } if ( $description ) { /* translators: Default privacy policy heading. */ $strings[] = '<h2>' . __( 'What personal data we collect and why we collect it' ) . '</h2>'; /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this section you should note what personal data you collect from users and site visitors. This may include personal data, such as name, email address, personal account preferences; transactional data, such as purchase information; and technical data, such as information about cookies.' ) . '</p>'; /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'You should also note any collection and retention of sensitive personal data, such as data concerning health.' ) . '</p>'; /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In addition to listing what personal data you collect, you need to note why you collect it. These explanations must note either the legal basis for your data collection and retention or the active consent the user has given.' ) . '</p>'; /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'Personal data is not just created by a user’s interactions with your site. Personal data is also generated from technical processes such as contact forms, comments, cookies, analytics, and third party embeds.' ) . '</p>'; /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default WordPress does not collect any personal data about visitors, and only collects the data shown on the User Profile screen from registered users. However some of your plugins may collect personal data. You should add the relevant information below.' ) . '</p>'; } /* translators: Default privacy policy heading. */ $strings[] = '<h2 class="wp-block-heading">' . __( 'Comments' ) . '</h2>'; if ( $description ) { /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information is captured through comments. We have noted the data which WordPress collects by default.' ) . '</p>'; } else { /* translators: Default privacy policy text. */ $strings[] = '<p>' . $suggested_text . __( 'When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection.' ) . '</p>'; /* translators: Default privacy policy text. */ $strings[] = '<p>' . __( 'An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.' ) . '</p>'; } /* translators: Default privacy policy heading. */ $strings[] = '<h2 class="wp-block-heading">' . __( 'Media' ) . '</h2>'; if ( $description ) { /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should note what information may be disclosed by users who can upload media files. All uploaded files are usually publicly accessible.' ) . '</p>'; } else { /* translators: Default privacy policy text. */ $strings[] = '<p>' . $suggested_text . __( 'If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.' ) . '</p>'; } if ( $description ) { /* translators: Default privacy policy heading. */ $strings[] = '<h2>' . __( 'Contact forms' ) . '</h2>'; /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'By default, WordPress does not include a contact form. If you use a contact form plugin, use this subsection to note what personal data is captured when someone submits a contact form, and how long you keep it. For example, you may note that you keep contact form submissions for a certain period for customer service purposes, but you do not use the information submitted through them for marketing purposes.' ) . '</p>'; } /* translators: Default privacy policy heading. */ $strings[] = '<h2 class="wp-block-heading">' . __( 'Cookies' ) . '</h2>'; if ( $description ) { /* translators: Privacy policy tutorial. */ $strings[] = '<p class="privacy-policy-tutorial">' . __( 'In this subsection you should list the cookies your website uses, including those set by your plugins, social media, and analytics. We have provided the cookies which WordPress installs by default.' ) . '</p>'; } else { /* translators: Default privacy policy text. */ $strings[] = '<p>' . $suggested_text . __( 'If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.' ) . '</p>'; /* translators: Default privacy policy text. */ $strings[] = '<p>' . __( 'If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.' ) . '</p>';Changelog
Introduced in 4.9.6. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$blocks parameter.from the docblockAbout this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-admin/includes/class-wp-privacy-policy-content.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.