Skip to content

Instantly share code, notes, and snippets.

@mikejolley
Created December 15, 2013 11:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mikejolley/f8577bf695aca828ea1a to your computer and use it in GitHub Desktop.
Save mikejolley/f8577bf695aca828ea1a to your computer and use it in GitHub Desktop.
/**
* 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