trait WordPressUrl (View source)

Methods

string
formatUrl(string $url, string $delimiter = 'wp-admin', string $fragment = 'cms')

Format the URL. If the URL is missing the WordPress directory fragment, it adds it before the common delimiter.

string
formatHomeUrl(string $url, string $fragment = 'cms')

Format the home URL. Make sure that it does not contain the "/cms" fragment.

string
formatSiteUrl(string $url, string $fragment = 'cms')

Format the site URL. If the URL does not contain the fragment, append it with a forward slash (if not inside the fragment) on the URL, but only if the current site is the main site or a subdomain site.

string
formatNetworkUrl(string $url, string $delimiter = 'wp-admin', string $fragment = 'cms')

Format the network URL. If the URL is missing the WordPress directory fragment, it adds it before the common delimiter.

Details

string formatUrl(string $url, string $delimiter = 'wp-admin', string $fragment = 'cms')

Format the URL. If the URL is missing the WordPress directory fragment, it adds it before the common delimiter.

Parameters

string $url
string $delimiter
string $fragment

Return Value

string

string formatHomeUrl(string $url, string $fragment = 'cms')

Format the home URL. Make sure that it does not contain the "/cms" fragment.

Parameters

string $url
string $fragment

Return Value

string

string formatSiteUrl(string $url, string $fragment = 'cms')

Format the site URL. If the URL does not contain the fragment, append it with a forward slash (if not inside the fragment) on the URL, but only if the current site is the main site or a subdomain site.

Parameters

string $url
string $fragment

Return Value

string

string formatNetworkUrl(string $url, string $delimiter = 'wp-admin', string $fragment = 'cms')

Format the network URL. If the URL is missing the WordPress directory fragment, it adds it before the common delimiter.

Parameters

string $url
string $delimiter
string $fragment

Return Value

string