This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

_deprecated_file( string $file, string $version, string $replacement = null, string $message = '' )

Mark a file as deprecated and inform when it has been used.


Description

There is a hook ‘deprecated_file_included’ that will be called that can be used to get the backtrace up to what file and function included the deprecated file.

The current behavior is to trigger a user error if WP_DEBUG is true.

This function is to be used in every file that is deprecated.


Parameters

$file

(string) (Required) The file that was included.

$version

(string) (Required) The version of ClassicPress or WordPress that deprecated the file.

$replacement

(string) (Optional) The file that should have been included based on ABSPATH.

Default value: null

$message

(string) (Optional) A message regarding the change.

Default value: ''


Source

File: wp-includes/functions.php

function _deprecated_file( $file, $version, $replacement = null, $message = '' ) {

	/**
	 * Fires when a deprecated file is called.
	 *
	 * @since WP-2.5.0
	 *
	 * @param string $file        The file that was called.
	 * @param string $replacement The file that should have been included based on ABSPATH.
	 * @param string $version     The version of ClassicPress or WordPress that deprecated the file.
	 * @param string $message     A message regarding the change.
	 */
	do_action( 'deprecated_file_included', $file, $replacement, $version, $message );

	/**
	 * Filters whether to trigger an error for deprecated files.
	 *
	 * @since WP-2.5.0
	 *
	 * @param bool $trigger Whether to trigger the error for deprecated files. Default true.
	 */
	if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
		$message = empty( $message ) ? '' : ' ' . $message;
		if ( function_exists( '__' ) ) {
			if ( ! is_null( $replacement ) ) {
				/* translators: 1: PHP file name, 2: version number, 3: alternative file name */
				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
			} else {
				/* translators: 1: PHP file name, 2: version number */
				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
			}
		} else {
			if ( ! is_null( $replacement ) ) {
				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
			} else {
				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
			}
		}
	}
}


Changelog

Changelog
Version Description
WP-2.5.0 Introduced.