Changeset 47122 for trunk/src/wp-includes/default-filters.php
- Timestamp:
- 01/29/2020 12:43:23 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/default-filters.php
r47018 r47122 13 13 */ 14 14 15 // Strip, trim, kses, special chars for string saves 15 // Strip, trim, kses, special chars for string saves. 16 16 foreach ( array( 'pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target', 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name', 'pre_user_nickname' ) as $filter ) { 17 17 add_filter( $filter, 'sanitize_text_field' ); … … 20 20 } 21 21 22 // Strip, kses, special chars for string display 22 // Strip, kses, special chars for string display. 23 23 foreach ( array( 'term_name', 'comment_author_name', 'link_name', 'link_target', 'link_rel', 'user_display_name', 'user_first_name', 'user_last_name', 'user_nickname' ) as $filter ) { 24 24 if ( is_admin() ) { … … 30 30 } 31 31 32 // Kses only for textarea saves 32 // Kses only for textarea saves. 33 33 foreach ( array( 'pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description' ) as $filter ) { 34 34 add_filter( $filter, 'wp_filter_kses' ); 35 35 } 36 36 37 // Kses only for textarea admin displays 37 // Kses only for textarea admin displays. 38 38 if ( is_admin() ) { 39 39 foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description' ) as $filter ) { … … 43 43 } 44 44 45 // Email saves 45 // Email saves. 46 46 foreach ( array( 'pre_comment_author_email', 'pre_user_email' ) as $filter ) { 47 47 add_filter( $filter, 'trim' ); … … 50 50 } 51 51 52 // Email admin display 52 // Email admin display. 53 53 foreach ( array( 'comment_author_email', 'user_email' ) as $filter ) { 54 54 add_filter( $filter, 'sanitize_email' ); … … 58 58 } 59 59 60 // Save URL 60 // Save URL. 61 61 foreach ( array( 62 62 'pre_comment_author_url', … … 72 72 } 73 73 74 // Display URL 74 // Display URL. 75 75 foreach ( array( 'user_url', 'link_url', 'link_image', 'link_rss', 'comment_url', 'post_guid' ) as $filter ) { 76 76 if ( is_admin() ) { … … 83 83 } 84 84 85 // Slugs 85 // Slugs. 86 86 add_filter( 'pre_term_slug', 'sanitize_title' ); 87 87 add_filter( 'wp_insert_post_data', '_wp_customize_changeset_filter_insert_post_data', 10, 2 ); 88 88 89 // Keys 89 // Keys. 90 90 foreach ( array( 'pre_post_type', 'pre_post_status', 'pre_post_comment_status', 'pre_post_ping_status' ) as $filter ) { 91 91 add_filter( $filter, 'sanitize_key' ); 92 92 } 93 93 94 // Mime types 94 // Mime types. 95 95 add_filter( 'pre_post_mime_type', 'sanitize_mime_type' ); 96 96 add_filter( 'post_mime_type', 'sanitize_mime_type' ); 97 97 98 // Meta 98 // Meta. 99 99 add_filter( 'register_meta_args', '_wp_register_meta_args_whitelist', 10, 2 ); 100 100 101 // Post meta 101 // Post meta. 102 102 add_action( 'added_post_meta', 'wp_cache_set_posts_last_changed' ); 103 103 add_action( 'updated_post_meta', 'wp_cache_set_posts_last_changed' ); 104 104 add_action( 'deleted_post_meta', 'wp_cache_set_posts_last_changed' ); 105 105 106 // Term meta 106 // Term meta. 107 107 add_action( 'added_term_meta', 'wp_cache_set_terms_last_changed' ); 108 108 add_action( 'updated_term_meta', 'wp_cache_set_terms_last_changed' ); … … 117 117 add_filter( 'update_term_metadata_cache', 'wp_check_term_meta_support_prefilter' ); 118 118 119 // Comment meta 119 // Comment meta. 120 120 add_action( 'added_comment_meta', 'wp_cache_set_comments_last_changed' ); 121 121 add_action( 'updated_comment_meta', 'wp_cache_set_comments_last_changed' ); 122 122 add_action( 'deleted_comment_meta', 'wp_cache_set_comments_last_changed' ); 123 123 124 // Places to balance tags on input 124 // Places to balance tags on input. 125 125 foreach ( array( 'content_save_pre', 'excerpt_save_pre', 'comment_save_pre', 'pre_comment_content' ) as $filter ) { 126 126 add_filter( $filter, 'convert_invalid_entities' ); … … 138 138 } 139 139 140 // Format WordPress 140 // Format WordPress. 141 141 foreach ( array( 'the_content', 'the_title', 'wp_title' ) as $filter ) { 142 142 add_filter( $filter, 'capital_P_dangit', 11 ); … … 144 144 add_filter( 'comment_text', 'capital_P_dangit', 31 ); 145 145 146 // Format titles 146 // Format titles. 147 147 foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title', 'nav_menu_attr_title', 'nav_menu_description' ) as $filter ) { 148 148 add_filter( $filter, 'wptexturize' ); … … 158 158 } 159 159 160 // Format for RSS 160 // Format for RSS. 161 161 add_filter( 'term_name_rss', 'convert_chars' ); 162 162 163 // Pre save hierarchy 163 // Pre save hierarchy. 164 164 add_filter( 'wp_insert_post_parent', 'wp_check_post_hierarchy_for_loops', 10, 2 ); 165 165 add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 ); 166 166 167 // Display filters 167 // Display filters. 168 168 add_filter( 'the_title', 'wptexturize' ); 169 169 add_filter( 'the_title', 'convert_chars' ); … … 210 210 add_filter( 'widget_text_content', 'do_shortcode', 11 ); // Runs after wpautop(); note that $post global will be null when shortcodes run. 211 211 212 // RSS filters 212 // RSS filters. 213 213 add_filter( 'the_title_rss', 'strip_tags' ); 214 214 add_filter( 'the_title_rss', 'ent2ncr', 8 ); … … 227 227 add_filter( 'the_guid', 'esc_url' ); 228 228 229 // Email filters 229 // Email filters. 230 230 add_filter( 'wp_mail', 'wp_staticize_emoji_for_email' ); 231 231 232 // Mark site as no longer fresh 232 // Mark site as no longer fresh. 233 233 foreach ( array( 'publish_post', 'publish_page', 'wp_ajax_save-widget', 'wp_ajax_widgets-order', 'customize_save_after' ) as $action ) { 234 234 add_action( $action, '_delete_option_fresh_site', 0 ); 235 235 } 236 236 237 // Misc filters 237 // Misc filters. 238 238 add_filter( 'option_ping_sites', 'privacy_ping_filter' ); 239 add_filter( 'option_blog_charset', '_wp_specialchars' ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop 239 add_filter( 'option_blog_charset', '_wp_specialchars' ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop. 240 240 add_filter( 'option_blog_charset', '_canonical_charset' ); 241 241 add_filter( 'option_home', '_config_wp_home' ); … … 277 277 add_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100 ); 278 278 279 // Actions 279 // Actions. 280 280 add_action( 'wp_head', '_wp_render_title_tag', 1 ); 281 281 add_action( 'wp_head', 'wp_enqueue_scripts', 1 ); … … 309 309 } 310 310 311 // Login actions 311 // Login actions. 312 312 add_filter( 'login_head', 'wp_resource_hints', 8 ); 313 313 add_action( 'login_head', 'wp_print_head_scripts', 9 ); … … 317 317 add_action( 'login_init', 'send_frame_options_header', 10, 0 ); 318 318 319 // Feed Generator Tags319 // Feed generator tags. 320 320 foreach ( array( 'rss2_head', 'commentsrss2_head', 'rss_head', 'rdf_header', 'atom_head', 'comments_atom_head', 'opml_head', 'app_head' ) as $action ) { 321 321 add_action( $action, 'the_generator' ); 322 322 } 323 323 324 // Feed Site Icon 324 // Feed Site Icon. 325 325 add_action( 'atom_head', 'atom_site_icon' ); 326 326 add_action( 'rss2_head', 'rss2_site_icon' ); 327 327 328 328 329 // WP Cron 329 // WP Cron. 330 330 if ( ! defined( 'DOING_CRON' ) ) { 331 331 add_action( 'init', 'wp_cron' ); 332 332 } 333 333 334 // 2 Actions 2 Furious 334 // 2 Actions 2 Furious. 335 335 add_action( 'do_feed_rdf', 'do_feed_rdf', 10, 0 ); 336 336 add_action( 'do_feed_rss', 'do_feed_rss', 10, 0 ); … … 360 360 add_action( 'welcome_panel', 'wp_welcome_panel' ); 361 361 362 // Privacy 362 // Privacy. 363 363 add_action( 'user_request_action_confirmed', '_wp_privacy_account_request_confirmed' ); 364 364 add_action( 'user_request_action_confirmed', '_wp_privacy_send_request_confirmation_notification', 12 ); // After request marked as completed. … … 370 370 add_action( 'wp_privacy_delete_old_export_files', 'wp_privacy_delete_old_export_files' ); 371 371 372 // Cron tasks 372 // Cron tasks. 373 373 add_action( 'wp_scheduled_delete', 'wp_scheduled_delete' ); 374 374 add_action( 'wp_scheduled_auto_draft_delete', 'wp_delete_auto_drafts' ); … … 377 377 add_action( 'delete_expired_transients', 'delete_expired_transients' ); 378 378 379 // Navigation menu actions 379 // Navigation menu actions. 380 380 add_action( 'delete_post', '_wp_delete_post_menu_item' ); 381 381 add_action( 'delete_term', '_wp_delete_tax_menu_item', 10, 3 ); … … 383 383 add_action( 'delete_post', '_wp_delete_customize_changeset_dependent_auto_drafts' ); 384 384 385 // Post Thumbnail CSS class filtering 385 // Post Thumbnail CSS class filtering. 386 386 add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add' ); 387 387 add_action( 'end_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_remove' ); 388 388 389 // Redirect Old Slugs389 // Redirect old slugs. 390 390 add_action( 'template_redirect', 'wp_old_slug_redirect' ); 391 391 add_action( 'post_updated', 'wp_check_for_changed_slugs', 12, 3 ); 392 392 add_action( 'attachment_updated', 'wp_check_for_changed_slugs', 12, 3 ); 393 393 394 // Redirect Old Dates394 // Redirect old dates. 395 395 add_action( 'post_updated', 'wp_check_for_changed_dates', 12, 3 ); 396 396 add_action( 'attachment_updated', 'wp_check_for_changed_dates', 12, 3 ); 397 397 398 // Nonce check for Post Previews398 // Nonce check for post previews. 399 399 add_action( 'init', '_show_post_preview' ); 400 400 401 // Output JS to reset window.name for previews 401 // Output JS to reset window.name for previews. 402 402 add_action( 'wp_head', 'wp_post_preview_js', 1 ); 403 403 404 // Timezone 404 // Timezone. 405 405 add_filter( 'pre_option_gmt_offset', 'wp_timezone_override_offset' ); 406 406 407 // Admin Color Schemes407 // Admin color schemes. 408 408 add_action( 'admin_init', 'register_admin_color_schemes', 1 ); 409 409 add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' ); … … 415 415 add_filter( 'pre_option_embed_autourls', '__return_true' ); 416 416 417 // Default settings for heartbeat 417 // Default settings for heartbeat. 418 418 add_filter( 'heartbeat_settings', 'wp_heartbeat_settings' ); 419 419 420 // Check if the user is logged out 420 // Check if the user is logged out. 421 421 add_action( 'admin_enqueue_scripts', 'wp_auth_check_load' ); 422 422 add_filter( 'heartbeat_send', 'wp_auth_check' ); 423 423 add_filter( 'heartbeat_nopriv_send', 'wp_auth_check' ); 424 424 425 // Default authentication filters 425 // Default authentication filters. 426 426 add_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 ); 427 427 add_filter( 'authenticate', 'wp_authenticate_email_password', 20, 3 ); … … 452 452 453 453 /** 454 * Filters formerly mixed into wp-includes 454 * Filters formerly mixed into wp-includes. 455 455 */ 456 // Theme 456 // Theme. 457 457 add_action( 'wp_loaded', '_custom_header_background_just_in_time' ); 458 458 add_action( 'wp_head', '_custom_logo_header_styles' ); … … 463 463 add_action( 'transition_post_status', '_wp_keep_alive_customize_changeset_dependent_auto_drafts', 20, 3 ); 464 464 465 // Calendar widget cache 465 // Calendar widget cache. 466 466 add_action( 'save_post', 'delete_get_calendar_cache' ); 467 467 add_action( 'delete_post', 'delete_get_calendar_cache' ); … … 469 469 add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' ); 470 470 471 // Author 471 // Author. 472 472 add_action( 'transition_post_status', '__clear_multi_author_cache' ); 473 473 474 // Post 475 add_action( 'init', 'create_initial_post_types', 0 ); // highest priority474 // Post. 475 add_action( 'init', 'create_initial_post_types', 0 ); // Highest priority. 476 476 add_action( 'admin_menu', '_add_post_type_submenus' ); 477 477 add_action( 'before_delete_post', '_reset_front_page_settings_for_post' ); … … 479 479 add_action( 'change_locale', 'create_initial_post_types' ); 480 480 481 // Post Formats 481 // Post Formats. 482 482 add_filter( 'request', '_post_format_request' ); 483 483 add_filter( 'term_link', '_post_format_link', 10, 3 ); … … 486 486 add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' ); 487 487 488 // KSES 488 // KSES. 489 489 add_action( 'init', 'kses_init' ); 490 490 add_action( 'set_current_user', 'kses_init' ); 491 491 492 // Script Loader 492 // Script Loader. 493 493 add_action( 'wp_default_scripts', 'wp_default_scripts' ); 494 494 add_action( 'wp_default_scripts', 'wp_default_packages' ); … … 510 510 add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 ); 511 511 512 // Taxonomy 513 add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority512 // Taxonomy. 513 add_action( 'init', 'create_initial_taxonomies', 0 ); // Highest priority. 514 514 add_action( 'change_locale', 'create_initial_taxonomies' ); 515 515 516 // Canonical 516 // Canonical. 517 517 add_action( 'template_redirect', 'redirect_canonical' ); 518 518 add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 ); 519 519 520 // Shortcodes 521 add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop() 522 523 // Media 520 // Shortcodes. 521 add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop(). 522 523 // Media. 524 524 add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' ); 525 525 add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings' ); 526 526 add_action( 'plugins_loaded', '_wp_add_additional_image_sizes', 0 ); 527 527 528 // Nav menu 528 // Nav menu. 529 529 add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 ); 530 530 531 // Widgets 531 // Widgets. 532 532 add_action( 'init', 'wp_widgets_init', 1 ); 533 533 534 // Admin Bar 534 // Admin Bar. 535 535 // Don't remove. Wrong way to disable. 536 536 add_action( 'template_redirect', '_wp_admin_bar_init', 0 ); … … 541 541 add_action( 'in_admin_header', 'wp_admin_bar_render', 0 ); 542 542 543 // Former admin filters that can also be hooked on the front end 543 // Former admin filters that can also be hooked on the front end. 544 544 add_action( 'media_buttons', 'media_buttons' ); 545 545 add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 ); 546 546 add_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 ); 547 547 548 // Embeds 548 // Embeds. 549 549 add_action( 'rest_api_init', 'wp_oembed_register_route' ); 550 550 add_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 ); … … 581 581 add_filter( 'pre_oembed_result', 'wp_filter_pre_oembed_result', 10, 3 ); 582 582 583 // Capabilities 583 // Capabilities. 584 584 add_filter( 'user_has_cap', 'wp_maybe_grant_install_languages_cap', 1 ); 585 585 add_filter( 'user_has_cap', 'wp_maybe_grant_resume_extensions_caps', 1 );
Note: See TracChangeset
for help on using the changeset viewer.