From 0b40d2f9cf07f0710ce27ff25c358cf2944bf9d2 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 2 May 2018 03:00:25 +0000 Subject: [PATCH] Privacy: fix `get_privacy_policy_url()` to only return the URL when the page is published. Props azaozz. Merges [42995] to the 4.9 branch. See #43435. Built from https://develop.svn.wordpress.org/branches/4.9@43102 git-svn-id: http://core.svn.wordpress.org/branches/4.9@42931 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/link-template.php | 6 +++--- wp-includes/version.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index fdc910d1bc..71557e1fc6 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -4115,9 +4115,9 @@ function get_parent_theme_file_path( $file = '' ) { function get_privacy_policy_url() { $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); - if ( empty( $policy_page_id ) ) { - return ''; + if ( ! empty( $policy_page_id ) && get_post_status( $policy_page_id ) === 'publish' ) { + return get_permalink( $policy_page_id ); } - return get_permalink( $policy_page_id ); + return ''; } diff --git a/wp-includes/version.php b/wp-includes/version.php index b2ffcdaa5c..a9960e4761 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9.6-alpha-43101'; +$wp_version = '4.9.6-alpha-43102'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.