Created
March 18, 2019 15:00
-
-
Save onesword0618/4587f8a5938da3f7d4f9f569403c2edb to your computer and use it in GitHub Desktop.
WPの関数:_deprecated_argument()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <? php | |
| function _deprecated_argument( $function, $version, $message = null ) { | |
| /** | |
| * Fires when a deprecated argument is called. | |
| * | |
| * @since 3.0.0 | |
| * | |
| * @param string $function The function that was called. | |
| * @param string $message A message regarding the change. | |
| * @param string $version The version of WordPress that deprecated the argument used. | |
| */ | |
| // 引数をもとにアクションフックに登録している関数を実行 | |
| do_action( 'deprecated_argument_run', $function, $message, $version ); | |
| /** | |
| * Filters whether to trigger an error for deprecated arguments. | |
| * | |
| * @since 3.0.0 | |
| * | |
| * @param bool $trigger Whether to trigger the error for deprecated arguments. Default true. | |
| */ | |
| // デバッグモードまたは、deprecated_argument_trigger_errorが登録されている場合 | |
| if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) { | |
| if ( function_exists( '__' ) ) { | |
| if ( ! is_null( $message ) ) { | |
| /* translators: 1: PHP function name, 2: version number, 3: optional message regarding the change */ | |
| trigger_error( sprintf( __( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s' ), $function, $version, $message ) ); | |
| } else { | |
| /* translators: 1: PHP function name, 2: version number */ | |
| trigger_error( sprintf( __( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.' ), $function, $version ) ); | |
| } | |
| } else { | |
| if ( ! is_null( $message ) ) { | |
| trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) ); | |
| } else { | |
| trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) ); | |
| } | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://developer.wordpress.org/reference/functions/_deprecated_argument/