Skip to content

Method

Get the action URL.

get_url( string $scheme = 'login', bool $network = null )

public

Parameters

$scheme string Default 'login'
The URL scheme.
$network bool Default null
Whether to retrieve the URL for the current network or current blog.

Return

string The action URL.

Source

public function get_url( $scheme = 'login', $network = null ) {
    global $wp_rewrite;

    if ( null === $network ) {
        $network = $this->network;
    }

    $function = $network ? 'network_home_url' : 'home_url';

    if ( tml_use_permalinks() ) {
        $path = user_trailingslashit(
            str_replace(
                '%pagename%',
                $this->get_slug(),
                $wp_rewrite->get_page_permastruct()
            )
        );
        $url  = $function( $path, $scheme );
    } else {
        $url = $function( '?action=' . $this->get_name(), $scheme );
    }

    /**
     * Filter the action URL.
     *
     * @since 7.0
     *
     * @param string $url     The action URL.
     * @param string $name    The action name.
     * @param string $scheme  The URL scheme.
     * @param bool   $network Whether to retrieve the URL for the current network or current blog.
     */
    return apply_filters( 'tml_get_action_url', $url, $this->get_name(), $scheme, $network );
}

Uses

Changelog

VersionDescription
7.0 Introduced.