Changeset 43002
- Timestamp:
- 04/25/2018 03:54:29 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r42995 r43002 4283 4283 */ 4284 4284 function get_privacy_policy_url() { 4285 $url = ''; 4285 4286 $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); 4286 4287 4287 4288 if ( ! empty( $policy_page_id ) && get_post_status( $policy_page_id ) === 'publish' ) { 4288 return get_permalink( $policy_page_id ); 4289 $url = (string) get_permalink( $policy_page_id ); 4290 } 4291 4292 /** 4293 * Filters the URL of the privacy policy page. 4294 * 4295 * @since 4.9.6 4296 * 4297 * @param string $url The URL to the privacy policy page. Empty string 4298 * if it doesn't exist. 4299 * @param int $policy_page_id The ID of privacy policy page. 4300 */ 4301 return apply_filters( 'privacy_policy_url', $url, $policy_page_id ); 4302 } 4303 4304 /** 4305 * Displays the privacy policy link with formatting, when applicable. 4306 * 4307 * @since 4.9.6 4308 * 4309 * @param string $before Optional. Display before privacy policy link. Default empty. 4310 * @param string $after Optional. Display after privacy policy link. Default empty. 4311 */ 4312 function the_privacy_policy_link( $before = '', $after = '' ) { 4313 echo get_the_privacy_policy_link( $before, $after ); 4314 } 4315 4316 /** 4317 * Returns the privacy policy link with formatting, when applicable. 4318 * 4319 * @since 4.9.6 4320 * 4321 * @param string $before Optional. Display before privacy policy link. Default empty. 4322 * @param string $after Optional. Display after privacy policy link. Default empty. 4323 * 4324 * @return string Markup for the link and surrounding elements. Empty string if it 4325 * doesn't exist. 4326 */ 4327 function get_the_privacy_policy_link( $before = '', $after = '' ) { 4328 $link = ''; 4329 $privacy_policy_url = get_privacy_policy_url(); 4330 4331 if ( $privacy_policy_url ) { 4332 $link = sprintf( 4333 '<a class="privacy-policy-link" href="%s">%s</a>', 4334 esc_url( $privacy_policy_url ), 4335 __( 'Privacy Policy' ) 4336 ); 4337 } 4338 4339 /** 4340 * Filters the privacy policy link. 4341 * 4342 * @since 4.9.6 4343 * 4344 * @param string $link The privacy policy link. Empty string if it 4345 * doesn't exist. 4346 * @param string $privacy_policy_url The URL of the privacy policy. Empty string 4347 * if it doesn't exist. 4348 */ 4349 $link = apply_filters( 'the_privacy_policy_link', $link, $privacy_policy_url ); 4350 4351 if ( $link ) { 4352 return $before . $link . $after; 4289 4353 } 4290 4354
Note: See TracChangeset
for help on using the changeset viewer.