Created
October 22, 2011 17:37
-
-
Save brandondove/1306260 to your computer and use it in GitHub Desktop.
_doing_it_wrong() definition
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 | |
/** | |
* Marks something as being incorrectly called. | |
* | |
* There is a hook doing_it_wrong_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. | |
* | |
* @package WordPress | |
* @subpackage Debug | |
* @since 3.1.0 | |
* @access private | |
* | |
* @uses do_action() Calls 'doing_it_wrong_run' and passes the function arguments. | |
* @uses apply_filters() Calls 'doing_it_wrong_trigger_error' and expects boolean value of true to do | |
* trigger or false to not trigger error. | |
* | |
* @param string $function The function that was called. | |
* @param string $message A message explaining what has been done incorrectly. | |
* @param string $version The version of WordPress where the message was added. | |
*/ | |
function _doing_it_wrong( $function, $message, $version ) { | |
$message .= ' ' . __('Please see <a href="http://codex.wordpress.org/Debugging_in_WordPress">Debugging in WordPress</a> for more information.'); | |
do_action( 'doing_it_wrong_run', $function, $message, $version ); | |
// Allow plugin to filter the output error trigger | |
if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) { | |
$version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version ); | |
trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) ); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment