wc_do_deprecated_action helper

This commit is contained in:
Mike Jolley 2016-08-15 11:02:49 +01:00
parent 6090e3cd00
commit 46793622df
1 changed files with 15 additions and 0 deletions

View File

@ -1416,3 +1416,18 @@ function wc_get_logger() {
$class = apply_filters( 'woocommerce_logging_class', 'WC_Logger' );
return new $class;
}
/**
* Runs a deprecated action with notice only if used.
* @since 2.7.0
* @param string $action
* @param array $args
* @param string $deprecated_in
* @param string $replacement
*/
function wc_do_deprecated_action( $action, $args, $deprecated_in, $replacement ) {
if ( has_action( $action ) ) {
_deprecated_function( 'Action: ' . $action, $deprecated_in, $replacement );
do_action_ref_array( $action, $args );
}
}