WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

wp_register_plugin_realpath() WP 3.9.0

Register a plugin's real path.

This is used in plugin_basename() to resolve symlinked paths.

Хуков нет.

Возвращает

true/false. Whether the path was able to be registered.

Использование

wp_register_plugin_realpath( $file );
$file(строка) (обязательный)
Known path to the file.

Заметки

  • Смотрите: wp_normalize_path()
  • Global. Массив. $wp_plugin_paths

Список изменений

С версии 3.9.0 Введена.

Код wp_register_plugin_realpath() WP 5.5.1

wp-includes/plugin.php
<?php
function wp_register_plugin_realpath( $file ) {
	global $wp_plugin_paths;

	// Normalize, but store as static to avoid recalculation of a constant value.
	static $wp_plugin_path = null, $wpmu_plugin_path = null;
	if ( ! isset( $wp_plugin_path ) ) {
		$wp_plugin_path   = wp_normalize_path( WP_PLUGIN_DIR );
		$wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR );
	}

	$plugin_path     = wp_normalize_path( dirname( $file ) );
	$plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) );

	if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) {
		return false;
	}

	if ( $plugin_path !== $plugin_realpath ) {
		$wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
	}

	return true;
}