Router extends Component

Handles URL routing.

Table of Contents

$route  : array<string|int, mixed>
The current route.
$routes  : array<string|int, mixed>
All routes.
__construct()  : mixed
Class constructor.
add_rewrite_rules()  : mixed
Adds rewrite rules.
disable_page_redirect()  : string
Disables page redirect.
disable_page_title()  : string
Disables page title.
flush_rewrite_rules()  : mixed
Flushes rewrite rules.
get_admin_url()  : string
Gets admin URL.
get_current_route()  : array<string|int, mixed>
Gets the current route.
get_current_route_name()  : string
Gets the current route name.
get_current_url()  : string
Gets the current URL.
get_redirect_url()  : string
Gets redirect URL.
get_return_url()  : string
Gets return URL.
get_route()  : array<string|int, mixed>
Gets route.
get_url()  : string
Gets route URL.
register_rest_routes()  : mixed
Registers REST routes.
set_page_context()  : array<string|int, mixed>
Sets page context.
set_page_template()  : string
Sets page template.
set_page_title()  : array<string|int, mixed>
Sets page title.
set_rewrite_slug()  : array<string|int, mixed>
Sets rewrite slug.
boot()  : mixed
Bootstraps component properties.
get_redirect_callbacks()  : array<string|int, mixed>
Gets redirect callbacks.
get_routes()  : array<string|int, mixed>
Gets routes.
get_url_params()  : array<string|int, mixed>
Gets URL parameters.
get_url_path()  : string
Gets URL path.
set_callbacks()  : mixed
Sets the action and filter callbacks.
set_property()  : mixed
Sets a property value.

Properties

Methods

__construct()

Class constructor.

public __construct([array<string|int, mixed> $args = [] ]) : mixed
Parameters
$args : array<string|int, mixed> = []

Component arguments.

Return values
mixed

disable_page_redirect()

Disables page redirect.

public disable_page_redirect(string $url) : string
Parameters
$url : string

Redirect URL.

Return values
string

disable_page_title()

Disables page title.

public disable_page_title(string $title) : string
Parameters
$title : string

Page title.

Return values
string

get_admin_url()

Gets admin URL.

public get_admin_url(string $type, int $id) : string
Parameters
$type : string

Object type.

$id : int

Object ID.

Return values
string

get_current_route()

Gets the current route.

public get_current_route() : array<string|int, mixed>
Return values
array<string|int, mixed>

get_return_url()

Gets return URL.

public get_return_url(string $name) : string
Parameters
$name : string

Route name.

Return values
string

get_route()

Gets route.

public get_route(string $name) : array<string|int, mixed>
Parameters
$name : string

Route name.

Return values
array<string|int, mixed>

get_url()

Gets route URL.

public get_url(string $name[, array<string|int, mixed> $query = [] ][, bool $filter = false ]) : string
Parameters
$name : string

Route name.

$query : array<string|int, mixed> = []

URL query.

$filter : bool = false

Remove custom query parameters?

Return values
string

set_page_context()

Sets page context.

public set_page_context(array<string|int, mixed> $args) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Template arguments.

Return values
array<string|int, mixed>

set_page_template()

Sets page template.

public set_page_template(array<string|int, mixed> $template) : string
Parameters
$template : array<string|int, mixed>

Template filepath.

Return values
string

set_page_title()

Sets page title.

public set_page_title(array<string|int, mixed> $parts) : array<string|int, mixed>
Parameters
$parts : array<string|int, mixed>

Title parts.

Return values
array<string|int, mixed>

set_rewrite_slug()

Sets rewrite slug.

public set_rewrite_slug(array<string|int, mixed> $args, string $type) : array<string|int, mixed>
Parameters
$args : array<string|int, mixed>

Default arguments.

$type : string

Post type or taxonomy.

Return values
array<string|int, mixed>

get_redirect_callbacks()

Gets redirect callbacks.

protected get_redirect_callbacks(array<string|int, mixed> $callbacks) : array<string|int, mixed>
Parameters
$callbacks : array<string|int, mixed>

Callback arguments.

Return values
array<string|int, mixed>

get_url_params()

Gets URL parameters.

protected get_url_params(string $name) : array<string|int, mixed>
Parameters
$name : string

Route name.

Return values
array<string|int, mixed>

get_url_path()

Gets URL path.

protected get_url_path(string $name) : string
Parameters
$name : string

Route name.

Return values
string

set_callbacks()

Sets the action and filter callbacks.

protected final set_callbacks(array<string|int, mixed> $callbacks) : mixed
Parameters
$callbacks : array<string|int, mixed>

Callback arguments.

Return values
mixed

set_property()

Sets a property value.

protected final set_property(string $name, mixed $value[, string $prefix = '' ]) : mixed
Parameters
$name : string

Property name.

$value : mixed

Property value.

$prefix : string = ''

Method prefix.

Return values
mixed