2015-05-29 19:04:26 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2015-10-15 00:35:24 +02:00
|
|
|
* Administration API: Default admin hooks
|
2015-05-29 19:04:26 +02:00
|
|
|
*
|
|
|
|
* @package WordPress
|
2015-10-15 00:35:24 +02:00
|
|
|
* @subpackage Administration
|
2015-05-29 19:04:26 +02:00
|
|
|
* @since 4.3.0
|
|
|
|
*/
|
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Bookmark hooks.
|
2015-05-29 19:04:26 +02:00
|
|
|
add_action( 'admin_page_access_denied', 'wp_link_manager_disabled_message' );
|
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Dashboard hooks.
|
2015-05-29 19:04:26 +02:00
|
|
|
add_action( 'activity_box_end', 'wp_dashboard_quota' );
|
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Media hooks.
|
2015-06-19 23:18:25 +02:00
|
|
|
add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' );
|
|
|
|
|
|
|
|
add_action( 'media_upload_image', 'wp_media_upload_handler' );
|
|
|
|
add_action( 'media_upload_audio', 'wp_media_upload_handler' );
|
|
|
|
add_action( 'media_upload_video', 'wp_media_upload_handler' );
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'media_upload_file', 'wp_media_upload_handler' );
|
2015-05-29 19:04:26 +02:00
|
|
|
|
|
|
|
add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' );
|
2015-06-19 23:18:25 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'post-html-upload-ui', 'media_upload_html_bypass' );
|
2015-06-19 23:18:25 +02:00
|
|
|
|
2015-05-29 19:04:26 +02:00
|
|
|
add_filter( 'async_upload_image', 'get_media_item', 10, 2 );
|
|
|
|
add_filter( 'async_upload_audio', 'get_media_item', 10, 2 );
|
|
|
|
add_filter( 'async_upload_video', 'get_media_item', 10, 2 );
|
2017-12-01 00:11:00 +01:00
|
|
|
add_filter( 'async_upload_file', 'get_media_item', 10, 2 );
|
2015-05-29 19:04:26 +02:00
|
|
|
|
2015-06-19 23:18:25 +02:00
|
|
|
add_filter( 'attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2 );
|
|
|
|
|
2015-05-29 19:04:26 +02:00
|
|
|
add_filter( 'media_upload_gallery', 'media_upload_gallery' );
|
|
|
|
add_filter( 'media_upload_library', 'media_upload_library' );
|
|
|
|
|
2015-06-19 23:18:25 +02:00
|
|
|
add_filter( 'media_upload_tabs', 'update_gallery_tab' );
|
2015-05-29 19:04:26 +02:00
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Misc hooks.
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'admin_init', 'wp_admin_headers' );
|
|
|
|
add_action( 'login_init', 'wp_admin_headers' );
|
|
|
|
add_action( 'admin_head', 'wp_admin_canonical_url' );
|
2015-05-29 19:04:26 +02:00
|
|
|
add_action( 'admin_head', 'wp_color_scheme_settings' );
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'admin_head', 'wp_site_icon' );
|
|
|
|
add_action( 'admin_head', '_ipad_meta' );
|
2015-06-19 23:18:25 +02:00
|
|
|
|
2016-06-29 21:36:28 +02:00
|
|
|
// Prerendering.
|
2016-07-13 14:54:28 +02:00
|
|
|
if ( ! is_customize_preview() ) {
|
|
|
|
add_filter( 'admin_print_styles', 'wp_resource_hints', 1 );
|
|
|
|
}
|
2016-06-29 21:36:28 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'admin_print_scripts-post.php', 'wp_page_reload_on_back_button_js' );
|
2016-06-02 03:30:27 +02:00
|
|
|
add_action( 'admin_print_scripts-post-new.php', 'wp_page_reload_on_back_button_js' );
|
2015-06-19 23:18:25 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'update_option_home', 'update_home_siteurl', 10, 2 );
|
|
|
|
add_action( 'update_option_siteurl', 'update_home_siteurl', 10, 2 );
|
2015-06-19 23:18:25 +02:00
|
|
|
add_action( 'update_option_page_on_front', 'update_home_siteurl', 10, 2 );
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'update_option_admin_email', 'wp_site_admin_email_change_notification', 10, 3 );
|
2015-06-19 23:18:25 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'add_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
|
2017-08-14 22:13:43 +02:00
|
|
|
add_action( 'update_option_new_admin_email', 'update_option_new_admin_email', 10, 2 );
|
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
add_filter( 'heartbeat_received', 'wp_check_locked_posts', 10, 3 );
|
|
|
|
add_filter( 'heartbeat_received', 'wp_refresh_post_lock', 10, 3 );
|
|
|
|
add_filter( 'heartbeat_received', 'heartbeat_autosave', 500, 2 );
|
2015-06-19 23:18:25 +02:00
|
|
|
|
2018-12-17 20:28:51 +01:00
|
|
|
add_filter( 'wp_refresh_nonces', 'wp_refresh_post_nonces', 10, 3 );
|
|
|
|
add_filter( 'wp_refresh_nonces', 'wp_refresh_heartbeat_nonces' );
|
|
|
|
|
2015-06-19 23:18:25 +02:00
|
|
|
add_filter( 'heartbeat_settings', 'wp_heartbeat_set_suspension' );
|
2015-05-29 19:04:26 +02:00
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Nav Menu hooks.
|
2015-05-29 19:04:26 +02:00
|
|
|
add_action( 'admin_head-nav-menus.php', '_wp_delete_orphaned_draft_menu_items' );
|
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Plugin hooks.
|
2015-05-29 19:04:26 +02:00
|
|
|
add_filter( 'whitelist_options', 'option_update_filter' );
|
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Plugin Install hooks.
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'install_plugins_featured', 'install_dashboard' );
|
|
|
|
add_action( 'install_plugins_upload', 'install_plugins_upload' );
|
|
|
|
add_action( 'install_plugins_search', 'display_plugins_table' );
|
|
|
|
add_action( 'install_plugins_popular', 'display_plugins_table' );
|
|
|
|
add_action( 'install_plugins_recommended', 'display_plugins_table' );
|
|
|
|
add_action( 'install_plugins_new', 'display_plugins_table' );
|
|
|
|
add_action( 'install_plugins_beta', 'display_plugins_table' );
|
|
|
|
add_action( 'install_plugins_favorites', 'display_plugins_table' );
|
2015-05-29 19:04:26 +02:00
|
|
|
add_action( 'install_plugins_pre_plugin-information', 'install_plugin_information' );
|
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Template hooks.
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'admin_enqueue_scripts', array( 'WP_Internal_Pointers', 'enqueue_scripts' ) );
|
|
|
|
add_action( 'user_register', array( 'WP_Internal_Pointers', 'dismiss_pointers_for_new_users' ) );
|
2015-05-29 19:04:26 +02:00
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Theme hooks.
|
2015-05-29 19:04:26 +02:00
|
|
|
add_action( 'customize_controls_print_footer_scripts', 'customize_themes_print_templates' );
|
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Theme Install hooks.
|
2015-05-29 19:04:26 +02:00
|
|
|
add_action( 'install_themes_pre_theme-information', 'install_theme_information' );
|
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// User hooks.
|
2015-05-29 19:04:26 +02:00
|
|
|
add_action( 'admin_init', 'default_password_nag_handler' );
|
2015-06-19 23:18:25 +02:00
|
|
|
|
2015-05-29 19:04:26 +02:00
|
|
|
add_action( 'admin_notices', 'default_password_nag' );
|
2017-07-27 04:10:42 +02:00
|
|
|
add_action( 'admin_notices', 'new_user_email_admin_notice' );
|
2015-05-29 19:04:26 +02:00
|
|
|
|
2015-06-19 23:18:25 +02:00
|
|
|
add_action( 'profile_update', 'default_password_nag_edit_user', 10, 2 );
|
|
|
|
|
2017-07-27 04:10:42 +02:00
|
|
|
add_action( 'personal_options_update', 'send_confirmation_on_profile_email' );
|
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Update hooks.
|
2016-07-05 18:46:29 +02:00
|
|
|
add_action( 'load-plugins.php', 'wp_plugin_update_rows', 20 ); // After wp_update_plugins() is called.
|
|
|
|
add_action( 'load-themes.php', 'wp_theme_update_rows', 20 ); // After wp_update_themes() is called.
|
2015-06-19 23:18:25 +02:00
|
|
|
|
2017-12-01 00:11:00 +01:00
|
|
|
add_action( 'admin_notices', 'update_nag', 3 );
|
Bootstrap/Load: Introduce a recovery mode for fixing fatal errors.
Using the new fatal handler introduced in [44962], an email is sent to the admin when a fatal error occurs. This email includes a secret link to enter recovery mode. When clicked, the link will be validated and on success a cookie will be placed on the client, enabling recovery mode for that user. This functionality is executed early before plugins and themes are loaded, in order to be unaffected by potential fatal errors these might be causing.
When in recovery mode, broken plugins and themes will be paused for that client, so that they are able to access the admin backend despite of these errors. They are notified about the broken extensions and the errors caused, and can then decide whether they would like to temporarily deactivate the extension or fix the problem and resume the extension.
A link in the admin bar allows the client to exit recovery mode.
Props timothyblynjacobs, afragen, flixos90, nerrad, miss_jwo, schlessera, spacedmonkey, swissspidy.
Fixes #46130, #44458.
Built from https://develop.svn.wordpress.org/trunk@44973
git-svn-id: http://core.svn.wordpress.org/trunk@44804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 22:53:51 +01:00
|
|
|
add_action( 'admin_notices', 'paused_plugins_notice', 5 );
|
|
|
|
add_action( 'admin_notices', 'paused_themes_notice', 5 );
|
2015-06-19 23:18:25 +02:00
|
|
|
add_action( 'admin_notices', 'maintenance_nag', 10 );
|
Administration: Improve user experience and clarify when in recovery mode.
This changeset introduces several changes around usability when recovery mode is active:
* Display a notice in the admin clarifying that the user is in recovery mode.
* Use a highlight color for the admin bar link to exit recovery mode.
* Exit recovery mode automatically when logging out.
* Include a recovery mode indicator in the title tag.
Props aandrewdixon, azaozz, dhanukanuwan, flixos90, henrywright, karmatosed, mapk, melchoyce, spacedmonkey, TimothyBlynJacobs, tinkerbelly.
See #46608.
Built from https://develop.svn.wordpress.org/trunk@45117
git-svn-id: http://core.svn.wordpress.org/trunk@44926 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-05 19:00:52 +02:00
|
|
|
add_action( 'admin_notices', 'wp_recovery_mode_nag', 1 );
|
2015-06-19 23:18:25 +02:00
|
|
|
|
|
|
|
add_filter( 'update_footer', 'core_update_footer' );
|
2015-05-29 19:04:26 +02:00
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Update Core hooks.
|
2015-05-29 19:04:26 +02:00
|
|
|
add_action( '_core_updated_successfully', '_redirect_to_about_wordpress' );
|
|
|
|
|
2015-05-31 04:00:26 +02:00
|
|
|
// Upgrade hooks.
|
|
|
|
add_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 );
|
2016-05-25 21:36:28 +02:00
|
|
|
add_action( 'upgrader_process_complete', 'wp_version_check', 10, 0 );
|
|
|
|
add_action( 'upgrader_process_complete', 'wp_update_plugins', 10, 0 );
|
|
|
|
add_action( 'upgrader_process_complete', 'wp_update_themes', 10, 0 );
|
2018-04-16 10:53:20 +02:00
|
|
|
|
2018-04-27 21:54:21 +02:00
|
|
|
// Privacy hooks
|
2018-05-09 03:02:22 +02:00
|
|
|
add_filter( 'wp_privacy_personal_data_erasure_page', 'wp_privacy_process_personal_data_erasure_page', 10, 5 );
|
2018-05-03 21:28:21 +02:00
|
|
|
add_filter( 'wp_privacy_personal_data_export_page', 'wp_privacy_process_personal_data_export_page', 10, 7 );
|
2018-04-27 21:54:21 +02:00
|
|
|
add_action( 'wp_privacy_personal_data_export_file', 'wp_privacy_generate_personal_data_export_file', 10 );
|
2018-05-10 22:43:22 +02:00
|
|
|
add_action( 'wp_privacy_personal_data_erased', '_wp_privacy_send_erasure_fulfillment_notification', 10 );
|
2018-04-27 21:54:21 +02:00
|
|
|
|
2018-04-16 10:53:20 +02:00
|
|
|
// Privacy policy text changes check.
|
Privacy: Replace intrusive policy update notice with menu bubbles.
Previously, when a plugin updated its suggested privacy policy text, an admin notice was shown on all screens in the Administration Panels. That was done in order to make sure that administrators were aware of it, so that they could update their policy if needed. That was a very heavy-handed and intrusive approach, though, which leads to a poor user experience, and notice fatigue.
An alternative approach is to use bubble notifications in the menu, similar to when plugins have updates that need to be installed. That still makes it obvious that something needs the administrator's attention, but is not as distracting as a notice.
The notice will still appear on the Privacy page, though, since it is relevant to that screen, and provides an explanation of why the bubble is appearing.
Props azaozz, xkon, iandunn.
Fixes #43954. See #43953.
Built from https://develop.svn.wordpress.org/trunk@43223
git-svn-id: http://core.svn.wordpress.org/trunk@43052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-10 21:52:21 +02:00
|
|
|
add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'text_change_check' ), 100 );
|
2018-04-16 10:53:20 +02:00
|
|
|
|
|
|
|
// Show a "postbox" with the text suggestions for a privacy policy.
|
2018-12-18 17:14:49 +01:00
|
|
|
add_action( 'admin_notices', array( 'WP_Privacy_Policy_Content', 'notice' ) );
|
2018-04-16 10:53:20 +02:00
|
|
|
|
|
|
|
// Add the suggested policy text from WordPress.
|
2018-05-09 01:45:21 +02:00
|
|
|
add_action( 'admin_init', array( 'WP_Privacy_Policy_Content', 'add_suggested_content' ), 1 );
|
2018-04-16 10:53:20 +02:00
|
|
|
|
Privacy: Replace intrusive policy update notice with menu bubbles.
Previously, when a plugin updated its suggested privacy policy text, an admin notice was shown on all screens in the Administration Panels. That was done in order to make sure that administrators were aware of it, so that they could update their policy if needed. That was a very heavy-handed and intrusive approach, though, which leads to a poor user experience, and notice fatigue.
An alternative approach is to use bubble notifications in the menu, similar to when plugins have updates that need to be installed. That still makes it obvious that something needs the administrator's attention, but is not as distracting as a notice.
The notice will still appear on the Privacy page, though, since it is relevant to that screen, and provides an explanation of why the bubble is appearing.
Props azaozz, xkon, iandunn.
Fixes #43954. See #43953.
Built from https://develop.svn.wordpress.org/trunk@43223
git-svn-id: http://core.svn.wordpress.org/trunk@43052 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-05-10 21:52:21 +02:00
|
|
|
// Update the cached policy info when the policy page is updated.
|
2018-04-16 10:53:20 +02:00
|
|
|
add_action( 'post_updated', array( 'WP_Privacy_Policy_Content', '_policy_page_updated' ) );
|
2018-06-28 04:42:29 +02:00
|
|
|
|
|
|
|
// Append '(Draft)' to draft page titles in the privacy page dropdown.
|
|
|
|
add_filter( 'list_pages', '_wp_privacy_settings_filter_draft_page_titles', 10, 2 );
|