From baf97d3ec5ffe7898a6d0893977eb812abab093c Mon Sep 17 00:00:00 2001 From: Daniel Walmsley Date: Mon, 23 Jan 2017 13:30:29 -0800 Subject: [PATCH] Sync: Fix undefined variable when processing shortcodes --- sync/class.jetpack-sync-module-posts.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sync/class.jetpack-sync-module-posts.php b/sync/class.jetpack-sync-module-posts.php index 76d655e4e26d8..344cdd129f5b3 100644 --- a/sync/class.jetpack-sync-module-posts.php +++ b/sync/class.jetpack-sync-module-posts.php @@ -190,13 +190,14 @@ function filter_post_content_and_add_links( $post_object ) { * @param array of shortcode tags to remove. */ $shortcodes_to_remove = apply_filters( 'jetpack_sync_do_not_expand_shortcodes', array( 'gallery', 'slideshow' ) ); + $removed_shortcode_callbacks = array(); foreach ( $shortcodes_to_remove as $shortcode ) { if ( isset ( $shortcode_tags[ $shortcode ] ) ) { - $shortcodes_and_callbacks_to_remove[ $shortcode ] = $shortcode_tags[ $shortcode ]; + $removed_shortcode_callbacks[ $shortcode ] = $shortcode_tags[ $shortcode ]; } } - array_map( 'remove_shortcode' , array_keys( $shortcodes_and_callbacks_to_remove ) ); + array_map( 'remove_shortcode' , array_keys( $removed_shortcode_callbacks ) ); /** This filter is already documented in core. wp-includes/post-template.php */ if ( Jetpack_Sync_Settings::get_setting( 'render_filtered_content' ) && $post_type->public ) { @@ -204,7 +205,7 @@ function filter_post_content_and_add_links( $post_object ) { $post->post_excerpt_filtered = apply_filters( 'the_excerpt', $post->post_excerpt ); } - foreach ( $shortcodes_and_callbacks_to_remove as $shortcode => $callback ) { + foreach ( $removed_shortcode_callbacks as $shortcode => $callback ) { add_shortcode( $shortcode, $callback ); }