wpseek.com
A WordPress-centric search engine for devs and theme authors
wp_dependencies_unique_hosts › WordPress Function
Since4.6.0
Deprecatedn/a
› wp_dependencies_unique_hosts ( No parameters )
Returns: |
|
Defined at: |
|
Codex: |
Retrieves a list of unique hosts of all enqueued scripts and styles.
Related Functions: wp_unique_post_slug, wp_send_user_request, wp_expand_dimensions, wp_internal_hosts, wp_is_using_https
Source
function wp_dependencies_unique_hosts() { global $wp_scripts, $wp_styles; $unique_hosts = array(); foreach ( array( $wp_scripts, $wp_styles ) as $dependencies ) { if ( $dependencies instanceof WP_Dependencies && ! empty( $dependencies->queue ) ) { foreach ( $dependencies->queue as $handle ) { if ( ! isset( $dependencies->registered[ $handle ] ) ) { continue; } /* @var _WP_Dependency $dependency */ $dependency = $dependencies->registered[ $handle ]; $parsed = wp_parse_url( $dependency->src ); if ( ! empty( $parsed['host'] ) && ! in_array( $parsed['host'], $unique_hosts, true ) && $parsed['host'] !== $_SERVER['SERVER_NAME'] ) { $unique_hosts[] = $parsed['host']; } } } } return $unique_hosts; }