Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ColonelMoutarde/a2bef084b19ba17d29159c9a3f45c186 to your computer and use it in GitHub Desktop.
Save ColonelMoutarde/a2bef084b19ba17d29159c9a3f45c186 to your computer and use it in GitHub Desktop.
fonctions wordpress
/**
* @param string $url
* @return string|string[]
*/
function force_relative_url(string $url)
{
return str_replace(get_site_url(), '', $url);
}
/**
* @param string $url
* @return string|string[]
*/
function force_http_connection_url(string $url)
{
return str_replace(get_site_url(), 'http://toto:toto@'.$_SERVER['SERVER_NAME'], $url);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment