add_rewrite_endpoint()

最后更新于:2021-11-25 19:25:49

add_rewrite_endpoint( string$name, int$places, string|bool$query_var=true)

Add an endpoint, like /trackback/.

参数

$name

(string) (Required) Name of the endpoint.

$places

(int) (Required) Endpoint mask describing the places the endpoint should be added. Accepts a mask of:

  • EP_ALL
  • EP_NONE
  • EP_ALL_ARCHIVES
  • EP_ATTACHMENT
  • EP_AUTHORS
  • EP_CATEGORIES
  • EP_COMMENTS
  • EP_DATE
  • EP_DAY
  • EP_MONTH
  • EP_PAGES
  • EP_PERMALINK
  • EP_ROOT
  • EP_SEARCH
  • EP_TAGS
  • EP_YEAR

$query_var

(string|bool) (Optional) Name of the corresponding query variable. Pass false to skip registering a query_var for this endpoint. Defaults to the value of $name.

Default value: true

源文件

文件: gc-includes/rewrite.php

function add_rewrite_endpoint( $name, $places, $query_var = true ) {
	global $gc_rewrite;
	$gc_rewrite->add_endpoint( $name, $places, $query_var );
}