Skip to content
Docs
Get RestroPress

Filter

rpress_account_url

Updated
On this page

Filters the URL of a customer account section.

Applied by rpress_account_url(), which is used for the account sidebar links and other section links. With pretty permalinks the section slug is a path segment of the account page; otherwise it is added as a query argument. A section without an endpoint gets the plain page URL. The filter does not run when there is no account page URL.

Available since RestroPress 3.5.1.

Parameters#

ParameterTypeDescription
$urlstringSection URL.
$sectionstringSection ID, such as profile, orders or addresses.
$page_idintPage the URL is built on.

Return value#

string. Section URL.

Example#

add_filter( 'rpress_account_url', 'my_account_section_url', 10, 3 );
function my_account_section_url( $url, $section, $page_id ) {
	if ( 'orders' === $section ) {
		$url = add_query_arg( 'ref', 'account', $url );
	}
	return $url;
}

Notes#

A changed path or domain does not create a matching rewrite rule; make sure the returned URL resolves.

Source#

Applied in:

  • includes/features/account/loader.php (line 236), in rpress_account_url()

See also#

Was this page helpful?