wp_plugin_directory_constants

函数
wp_plugin_directory_constants ( No parameters )

wp_plugin_directory_constants: 这个函数定义了在WordPress插件目录中使用的常量。

定义插件目录的WordPress常量。

定义必须使用的插件目录常量,这些常量可以在sunrise.php drop-in中被重写。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function wp_plugin_directory_constants() {
if ( ! defined( 'WP_CONTENT_URL' ) ) {
define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); // Full URL - WP_CONTENT_DIR is defined further up.
}
/**
* Allows for the plugins directory to be moved from the default location.
*
* @since 2.6.0
*/
if ( ! defined( 'WP_PLUGIN_DIR' ) ) {
define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // Full path, no trailing slash.
}
/**
* Allows for the plugins directory to be moved from the default location.
*
* @since 2.6.0
*/
if ( ! defined( 'WP_PLUGIN_URL' ) ) {
define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // Full URL, no trailing slash.
}
/**
* Allows for the plugins directory to be moved from the default location.
*
* @since 2.1.0
* @deprecated
*/
if ( ! defined( 'PLUGINDIR' ) ) {
define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
}
/**
* Allows for the mu-plugins directory to be moved from the default location.
*
* @since 2.8.0
*/
if ( ! defined( 'WPMU_PLUGIN_DIR' ) ) {
define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // Full path, no trailing slash.
}
/**
* Allows for the mu-plugins directory to be moved from the default location.
*
* @since 2.8.0
*/
if ( ! defined( 'WPMU_PLUGIN_URL' ) ) {
define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // Full URL, no trailing slash.
}
/**
* Allows for the mu-plugins directory to be moved from the default location.
*
* @since 2.8.0
* @deprecated
*/
if ( ! defined( 'MUPLUGINDIR' ) ) {
define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
}
}
function wp_plugin_directory_constants() { if ( ! defined( 'WP_CONTENT_URL' ) ) { define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); // Full URL - WP_CONTENT_DIR is defined further up. } /** * Allows for the plugins directory to be moved from the default location. * * @since 2.6.0 */ if ( ! defined( 'WP_PLUGIN_DIR' ) ) { define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // Full path, no trailing slash. } /** * Allows for the plugins directory to be moved from the default location. * * @since 2.6.0 */ if ( ! defined( 'WP_PLUGIN_URL' ) ) { define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // Full URL, no trailing slash. } /** * Allows for the plugins directory to be moved from the default location. * * @since 2.1.0 * @deprecated */ if ( ! defined( 'PLUGINDIR' ) ) { define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat. } /** * Allows for the mu-plugins directory to be moved from the default location. * * @since 2.8.0 */ if ( ! defined( 'WPMU_PLUGIN_DIR' ) ) { define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // Full path, no trailing slash. } /** * Allows for the mu-plugins directory to be moved from the default location. * * @since 2.8.0 */ if ( ! defined( 'WPMU_PLUGIN_URL' ) ) { define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // Full URL, no trailing slash. } /** * Allows for the mu-plugins directory to be moved from the default location. * * @since 2.8.0 * @deprecated */ if ( ! defined( 'MUPLUGINDIR' ) ) { define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat. } }
function wp_plugin_directory_constants() {
	if ( ! defined( 'WP_CONTENT_URL' ) ) {
		define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' ); // Full URL - WP_CONTENT_DIR is defined further up.
	}

	/**
	 * Allows for the plugins directory to be moved from the default location.
	 *
	 * @since 2.6.0
	 */
	if ( ! defined( 'WP_PLUGIN_DIR' ) ) {
		define( 'WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' ); // Full path, no trailing slash.
	}

	/**
	 * Allows for the plugins directory to be moved from the default location.
	 *
	 * @since 2.6.0
	 */
	if ( ! defined( 'WP_PLUGIN_URL' ) ) {
		define( 'WP_PLUGIN_URL', WP_CONTENT_URL . '/plugins' ); // Full URL, no trailing slash.
	}

	/**
	 * Allows for the plugins directory to be moved from the default location.
	 *
	 * @since 2.1.0
	 * @deprecated
	 */
	if ( ! defined( 'PLUGINDIR' ) ) {
		define( 'PLUGINDIR', 'wp-content/plugins' ); // Relative to ABSPATH. For back compat.
	}

	/**
	 * Allows for the mu-plugins directory to be moved from the default location.
	 *
	 * @since 2.8.0
	 */
	if ( ! defined( 'WPMU_PLUGIN_DIR' ) ) {
		define( 'WPMU_PLUGIN_DIR', WP_CONTENT_DIR . '/mu-plugins' ); // Full path, no trailing slash.
	}

	/**
	 * Allows for the mu-plugins directory to be moved from the default location.
	 *
	 * @since 2.8.0
	 */
	if ( ! defined( 'WPMU_PLUGIN_URL' ) ) {
		define( 'WPMU_PLUGIN_URL', WP_CONTENT_URL . '/mu-plugins' ); // Full URL, no trailing slash.
	}

	/**
	 * Allows for the mu-plugins directory to be moved from the default location.
	 *
	 * @since 2.8.0
	 * @deprecated
	 */
	if ( ! defined( 'MUPLUGINDIR' ) ) {
		define( 'MUPLUGINDIR', 'wp-content/mu-plugins' ); // Relative to ABSPATH. For back compat.
	}
}

常见问题

FAQs
查看更多 >