includes_url

函数
includes_url ( $path = '', $scheme = null )
参数
  • (string) $path Optional. Path relative to the includes URL. Default empty.
    Required:
    Default: (empty)
  • (string|null) $scheme Optional. Scheme to give the includes URL context. Accepts 'http', 'https', or 'relative'. Default null.
    Required:
    Default: null
返回值
  • (string) Includes URL link with optional path appended.
定义位置
相关方法
clean_urlesc_urlplugins_urlrest_urlwp_nonce_url
引入
2.6.0
弃用
-

includes_url: 这个函数返回到WordPress安装的”includes”目录的URL。这通常用于加载CSS、JavaScript或其他包含在WordPress中的资产。

检索到包括目录的URL。

function includes_url( $path = '', $scheme = null ) {
	$url = site_url( '/' . WPINC . '/', $scheme );

	if ( $path && is_string( $path ) ) {
		$url .= ltrim( $path, '/' );
	}

	/**
	 * Filters the URL to the includes directory.
	 *
	 * @since 2.8.0
	 * @since 5.8.0 The `$scheme` parameter was added.
	 *
	 * @param string      $url    The complete URL to the includes directory including scheme and path.
	 * @param string      $path   Path relative to the URL to the wp-includes directory. Blank string
	 *                            if no path is specified.
	 * @param string|null $scheme Scheme to give the includes URL context. Accepts
	 *                            'http', 'https', 'relative', or null. Default null.
	 */
	return apply_filters( 'includes_url', $url, $path, $scheme );
}

常见问题

FAQs
查看更多 >