Deprecation functions should not output errors during REST requests.
This commit is contained in:
parent
3ff2c2f053
commit
8ad8a4efa5
|
@ -43,7 +43,7 @@ function wc_do_deprecated_action( $tag, $args, $version, $replacement = null, $m
|
||||||
*/
|
*/
|
||||||
function wc_deprecated_function( $function, $version, $replacement = null ) {
|
function wc_deprecated_function( $function, $version, $replacement = null ) {
|
||||||
// @codingStandardsIgnoreStart
|
// @codingStandardsIgnoreStart
|
||||||
if ( is_ajax() ) {
|
if ( is_ajax() || WC()->is_rest_api_request() ) {
|
||||||
do_action( 'deprecated_function_run', $function, $replacement, $version );
|
do_action( 'deprecated_function_run', $function, $replacement, $version );
|
||||||
$log_string = "The {$function} function is deprecated since version {$version}.";
|
$log_string = "The {$function} function is deprecated since version {$version}.";
|
||||||
$log_string .= $replacement ? " Replace with {$replacement}." : '';
|
$log_string .= $replacement ? " Replace with {$replacement}." : '';
|
||||||
|
@ -65,7 +65,7 @@ function wc_deprecated_function( $function, $version, $replacement = null ) {
|
||||||
*/
|
*/
|
||||||
function wc_deprecated_hook( $hook, $version, $replacement = null, $message = null ) {
|
function wc_deprecated_hook( $hook, $version, $replacement = null, $message = null ) {
|
||||||
// @codingStandardsIgnoreStart
|
// @codingStandardsIgnoreStart
|
||||||
if ( is_ajax() ) {
|
if ( is_ajax() || WC()->is_rest_api_request() ) {
|
||||||
do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message );
|
do_action( 'deprecated_hook_run', $hook, $replacement, $version, $message );
|
||||||
|
|
||||||
$message = empty( $message ) ? '' : ' ' . $message;
|
$message = empty( $message ) ? '' : ' ' . $message;
|
||||||
|
@ -109,7 +109,7 @@ function wc_doing_it_wrong( $function, $message, $version ) {
|
||||||
// @codingStandardsIgnoreStart
|
// @codingStandardsIgnoreStart
|
||||||
$message .= ' Backtrace: ' . wp_debug_backtrace_summary();
|
$message .= ' Backtrace: ' . wp_debug_backtrace_summary();
|
||||||
|
|
||||||
if ( is_ajax() ) {
|
if ( is_ajax() || WC()->is_rest_api_request() ) {
|
||||||
do_action( 'doing_it_wrong_run', $function, $message, $version );
|
do_action( 'doing_it_wrong_run', $function, $message, $version );
|
||||||
error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
|
error_log( "{$function} was called incorrectly. {$message}. This message was added in version {$version}." );
|
||||||
} else {
|
} else {
|
||||||
|
@ -127,7 +127,7 @@ function wc_doing_it_wrong( $function, $message, $version ) {
|
||||||
* @param string $replacement
|
* @param string $replacement
|
||||||
*/
|
*/
|
||||||
function wc_deprecated_argument( $argument, $version, $message = null ) {
|
function wc_deprecated_argument( $argument, $version, $message = null ) {
|
||||||
if ( is_ajax() ) {
|
if ( is_ajax() || WC()->is_rest_api_request() ) {
|
||||||
do_action( 'deprecated_argument_run', $argument, $message, $version );
|
do_action( 'deprecated_argument_run', $argument, $message, $version );
|
||||||
error_log( "The {$argument} argument is deprecated since version {$version}. {$message}" );
|
error_log( "The {$argument} argument is deprecated since version {$version}. {$message}" );
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue