mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Privacy: Only link to menus panel in Customizer if selected privacy page can be accessed there.
Props dlh. Fixes #44117. Built from https://develop.svn.wordpress.org/trunk@43343 git-svn-id: http://core.svn.wordpress.org/trunk@43171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ba9e0ac030
commit
8f21b4c607
@ -22,14 +22,33 @@ if ( ! empty( $action ) ) {
|
|||||||
$privacy_policy_page_id = isset( $_POST['page_for_privacy_policy'] ) ? (int) $_POST['page_for_privacy_policy'] : 0;
|
$privacy_policy_page_id = isset( $_POST['page_for_privacy_policy'] ) ? (int) $_POST['page_for_privacy_policy'] : 0;
|
||||||
update_option( 'wp_page_for_privacy_policy', $privacy_policy_page_id );
|
update_option( 'wp_page_for_privacy_policy', $privacy_policy_page_id );
|
||||||
|
|
||||||
|
$privacy_page_updated_message = __( 'Privacy policy page updated successfully.' );
|
||||||
|
|
||||||
|
if ( $privacy_policy_page_id ) {
|
||||||
|
/*
|
||||||
|
* Don't always link to the menu customizer:
|
||||||
|
*
|
||||||
|
* - Unpublished pages can't be selected by default.
|
||||||
|
* - `WP_Customize_Nav_Menus::__construct()` checks the user's capabilities.
|
||||||
|
* - Themes might not "officially" support menus.
|
||||||
|
*/
|
||||||
|
if (
|
||||||
|
'publish' === get_post_status( $privacy_policy_page_id )
|
||||||
|
&& current_user_can( 'edit_theme_options' )
|
||||||
|
&& current_theme_supports( 'menus' )
|
||||||
|
) {
|
||||||
|
$privacy_page_updated_message = sprintf(
|
||||||
|
/* translators: %s: URL to Customizer -> Menus */
|
||||||
|
__( 'Privacy policy page updated successfully. Remember to <a href="%s">update your menus</a>!' ),
|
||||||
|
esc_url( add_query_arg( 'autofocus[panel]', 'nav_menus', admin_url( 'customize.php' ) ) )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
add_settings_error(
|
add_settings_error(
|
||||||
'page_for_privacy_policy',
|
'page_for_privacy_policy',
|
||||||
'page_for_privacy_policy',
|
'page_for_privacy_policy',
|
||||||
sprintf(
|
$privacy_page_updated_message,
|
||||||
/* translators: %s: URL to Customizer -> Menus */
|
|
||||||
__( 'Privacy policy page updated successfully. Remember to <a href="%s">update your menus</a>!' ),
|
|
||||||
'customize.php?autofocus[panel]=nav_menus'
|
|
||||||
),
|
|
||||||
'updated'
|
'updated'
|
||||||
);
|
);
|
||||||
} elseif ( 'create-privacy-page' === $action ) {
|
} elseif ( 'create-privacy-page' === $action ) {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.0-alpha-43341';
|
$wp_version = '5.0-alpha-43343';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
Loading…
Reference in New Issue
Block a user