wc_deprecated_function( string $function, string $version, string $replacement = null )

Wrapper for deprecated functions so we can apply some extra logic.

Description Description

Parameters Parameters


(Required) Function used.


(Required) Version the message was added in.


(Optional) Replacement for the called function.

Default value: null

Top ↑

Source Source

File: includes/wc-deprecated-functions.php

function wc_deprecated_function( $function, $version, $replacement = null ) {
	// @codingStandardsIgnoreStart
	if ( is_ajax() || WC()->is_rest_api_request() ) {
		do_action( 'deprecated_function_run', $function, $replacement, $version );
		$log_string  = "The {$function} function is deprecated since version {$version}.";
		$log_string .= $replacement ? " Replace with {$replacement}." : '';
		error_log( $log_string );
	} else {
		_deprecated_function( $function, $version, $replacement );
	// @codingStandardsIgnoreEnd

Top ↑

Changelog Changelog

Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.