-
-
Save mikejolley/f8577bf695aca828ea1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Handle renamed filters | |
*/ | |
global $wc_map_deprecated_filters; | |
$wc_map_deprecated_filters = array( | |
'woocommerce_cart_item_class' => 'woocommerce_cart_table_item_class' | |
); | |
foreach ( $wc_map_deprecated_filters as $new => $old ) | |
add_filter( $new, 'woocommerce_deprecated_filter_mapping' ); | |
function woocommerce_deprecated_filter_mapping( $data, $arg_1 = '', $arg_2 = '', $arg_3 = '' ) { | |
global $wc_map_deprecated_filters; | |
$filter = current_filter(); | |
if ( isset( $wc_map_deprecated_filters[ $filter ] ) ) | |
if ( has_filter( $wc_map_deprecated_filters[ $filter ] ) ) { | |
$data = apply_filters( $wc_map_deprecated_filters[ $filter ], $data, $arg_1, $arg_2, $arg_3 ); | |
_deprecated_function( 'The ' . $wc_map_deprecated_filters[ $filter ] . ' filter', '2.1', $filter ); | |
} | |
return $data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment