wc_get_page_permalink( string $page, string|bool $fallback = null )

Retrieve page permalink.


Description Description


Parameters Parameters

$page

(Required) page slug.

$fallback

(Optional) Fallback URL if page is not set. Defaults to home URL. @since 3.4.0.

Default value: null


Top ↑

Return Return

(string)


Top ↑

Source Source

File: includes/wc-page-functions.php

function wc_get_page_permalink( $page, $fallback = null ) {
	$page_id   = wc_get_page_id( $page );
	$permalink = 0 < $page_id ? get_permalink( $page_id ) : '';

	if ( ! $permalink ) {
		$permalink = is_null( $fallback ) ? get_home_url() : $fallback;
	}

	return apply_filters( 'woocommerce_get_' . $page . '_page_permalink', $permalink );
}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.