WP_Privacy_Policy_Content::privacy_policy_guide()
Outputs the privacy policy guide together with content from the theme and plugins.
Method of the class: WP_Privacy_Policy_Content{}
No Hooks.
Return
null
. Nothing (null).
Usage
$result = WP_Privacy_Policy_Content::privacy_policy_guide();
Changelog
Since 4.9.6 | Introduced. |
WP_Privacy_Policy_Content::privacy_policy_guide() WP Privacy Policy Content::privacy policy guide code WP 6.6.2
<?php public static function privacy_policy_guide() { $content_array = self::get_suggested_policy_text(); $content = ''; $date_format = __( 'F j, Y' ); foreach ( $content_array as $section ) { $class = ''; $meta = ''; $removed = ''; if ( ! empty( $section['removed'] ) ) { $badge_class = ' red'; $date = date_i18n( $date_format, $section['removed'] ); /* translators: %s: Date of plugin deactivation. */ $badge_title = sprintf( __( 'Removed %s.' ), $date ); /* translators: %s: Date of plugin deactivation. */ $removed = sprintf( __( 'You deactivated this plugin on %s and may no longer need this policy.' ), $date ); $removed = wp_get_admin_notice( $removed, array( 'type' => 'info', 'additional_classes' => array( 'inline' ), ) ); } elseif ( ! empty( $section['updated'] ) ) { $badge_class = ' blue'; $date = date_i18n( $date_format, $section['updated'] ); /* translators: %s: Date of privacy policy text update. */ $badge_title = sprintf( __( 'Updated %s.' ), $date ); } $plugin_name = esc_html( $section['plugin_name'] ); $sanitized_policy_name = sanitize_title_with_dashes( $plugin_name ); ?> <h4 class="privacy-settings-accordion-heading"> <button aria-expanded="false" class="privacy-settings-accordion-trigger" aria-controls="privacy-settings-accordion-block-<?php echo $sanitized_policy_name; ?>" type="button"> <span class="title"><?php echo $plugin_name; ?></span> <?php if ( ! empty( $section['removed'] ) || ! empty( $section['updated'] ) ) : ?> <span class="badge <?php echo $badge_class; ?>"> <?php echo $badge_title; ?></span> <?php endif; ?> <span class="icon"></span> </button> </h4> <div id="privacy-settings-accordion-block-<?php echo $sanitized_policy_name; ?>" class="privacy-settings-accordion-panel privacy-text-box-body" hidden="hidden"> <?php echo $removed; echo $section['policy_text']; ?> <?php if ( empty( $section['removed'] ) ) : ?> <div class="privacy-settings-accordion-actions"> <span class="success" aria-hidden="true"><?php _e( 'Copied!' ); ?></span> <button type="button" class="privacy-text-copy button"> <span aria-hidden="true"><?php _e( 'Copy suggested policy text to clipboard' ); ?></span> <span class="screen-reader-text"> <?php /* translators: Hidden accessibility text. %s: Plugin name. */ printf( __( 'Copy suggested policy text from %s.' ), $plugin_name ); ?> </span> </button> </div> <?php endif; ?> </div> <?php } }