wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
strip_fragment_from_url › WordPress Function
Seit4.4.0
Veraltetn/v
› strip_fragment_from_url ( $url )
| Parameter: |
|
| Gibt zurück: |
|
| Definiert in: |
|
| Codex: |
Strips the #fragment from a URL, if one is present.
Ähnliche Funktionen: stripslashes_from_strings_only, get_home_url, get_blog_id_from_url, iframe_footer, rest_get_avatar_urls
Quellcode
function strip_fragment_from_url( $url ) {
$parsed_url = wp_parse_url( $url );
if ( ! empty( $parsed_url['host'] ) ) {
$url = '';
if ( ! empty( $parsed_url['scheme'] ) ) {
$url = $parsed_url['scheme'] . ':';
}
$url .= '//' . $parsed_url['host'];
if ( ! empty( $parsed_url['port'] ) ) {
$url .= ':' . $parsed_url['port'];
}
if ( ! empty( $parsed_url['path'] ) ) {
$url .= $parsed_url['path'];
}
if ( ! empty( $parsed_url['query'] ) ) {
$url .= '?' . $parsed_url['query'];
}
}
return $url;
}