• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / _edd_deprected_argument() – Marks an argument in a function deprecated and informs when it’s been used

You appear to be a bot. Output may be restricted

Description

Marks an argument in a function deprecated and informs when it's been used

There is a hook edd_deprecated_argument_run that will be called that can be used to get the backtrace up to what file and function called the deprecated function. The current behavior is to trigger a user error if WP_DEBUG is true. This function is to be used in every function that has an argument being deprecated.

Usage

_edd_deprected_argument( $argument, $function, $version, $replacement, $backtrace );

Parameters

$argument
( string ) required – The arguemnt that is being deprecated
$function
( string ) required – The function that was called
$version
( string ) required – The version of WordPress that deprecated the function
$replacement
( string ) optional – Optional. The function that should have been called
$backtrace
( array ) optional – Optional. Contains stack backtrace of deprecated function

Returns

void

Source

File name: easy-digital-downloads/includes/misc-functions.php
Lines:

1 to 25 of 25
function _edd_deprected_argument( $argument, $function, $version, $replacement = null, $backtrace = null ) {
  do_action( 'edd_deprecated_argument_run', $argument, $function, $replacement, $version );

  $show_errors = current_user_can( 'manage_options' );

  // Allow plugin to filter the output error trigger
  if ( WP_DEBUG && apply_filters( 'edd_deprecated_argument_trigger_error', $show_errors ) ) {
    if ( ! is_null( $replacement ) ) {
      trigger_error( sprintf( __( 'The %1$s argument of %2$s is <strong>deprecated</strong> since Easy Digital Downloads version %3$s! Please use %4$s instead.', 'easy-digital-downloads' ), $argument, $function, $version, $replacement ) );

      if ( ! empty( $backtrace ) ) {
        trigger_error(  print_r( $backtrace, 1 ) ); // Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
      }

      // Alternatively we could dump this to a file.
    } else {
      trigger_error( sprintf( __( 'The %1$s argument of %2$s is <strong>deprecated</strong> since Easy Digital Downloads version %3$s with no alternative available.', 'easy-digital-downloads' ), $argument, $function, $version ) );

      if ( ! empty( $backtrace ) ) {
        trigger_error( print_r( $backtrace, 1 ) );// Limited to previous 1028 characters, but since we only need to move back 1 in stack that should be fine.
      }
      // Alternatively we could dump this to a file.
    }
  }
}
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 14th November 2021

Primary Sidebar

Information

Function name: _edd_deprected_argument
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/misc-functions.php
File ref: includes/misc-functions.php
API type: private
Deprecated?: No
API Letters: _,A,D,E

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.9.3
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2022. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites