From 3d15757198d9ef6408ba4cbc4f4cd41c54889378 Mon Sep 17 00:00:00 2001 From: Mark Jaquith Date: Thu, 6 Aug 2015 20:39:35 +0000 Subject: [PATCH] Move media hooks out of `admin-filters.php` as sometimes editors are used on the front end. fixes #33257 props wonderboymusic git-svn-id: https://develop.svn.wordpress.org/trunk@33590 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/admin-filters.php | 6 ------ src/wp-includes/default-filters.php | 5 +++++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/wp-admin/includes/admin-filters.php b/src/wp-admin/includes/admin-filters.php index 2f0e225781..d0709f4f8a 100644 --- a/src/wp-admin/includes/admin-filters.php +++ b/src/wp-admin/includes/admin-filters.php @@ -17,8 +17,6 @@ add_action( 'activity_box_end', 'wp_dashboard_quota' ); // Media hooks. add_action( 'attachment_submitbox_misc_actions', 'attachment_submitbox_metadata' ); -add_action( 'media_buttons', 'media_buttons' ); - 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' ); @@ -35,10 +33,6 @@ add_filter( 'async_upload_file', 'get_media_item', 10, 2 ); add_filter( 'attachment_fields_to_save', 'image_attachment_fields_to_save', 10, 2 ); -add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 ); - -add_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 ); - add_filter( 'media_upload_gallery', 'media_upload_gallery' ); add_filter( 'media_upload_library', 'media_upload_library' ); diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 27b0aa784a..a1c9c97335 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -401,4 +401,9 @@ add_action( 'admin_init', '_wp_admin_bar_init' ); add_action( 'wp_footer', 'wp_admin_bar_render', 1000 ); add_action( 'in_admin_header', 'wp_admin_bar_render', 0 ); +// Former admin filters that can also be hooked on the front end +add_action( 'media_buttons', 'media_buttons' ); +add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 ); +add_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 ); + unset( $filter, $action );