首页 WordPress函数大全 add_rewrite_tag()

add_rewrite_tag()

2020-05-01 / 4117阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

add_rewrite_tag( string $tag, string $regex, string $query = '' )

Add a new rewrite tag (like %postname%).

描述

The $query parameter is optional. If it is omitted you must ensure that you call this>‘init’ hook. This is because $query defaults to "$tag=", and for this to work a new query var has to be added.

参数

$tag

(string)
(Required)
Name of the new rewrite tag.

$regex

(string)
(Required)
Regular expression to substitute the tag for in rewrite rules.

$query

(string)
(Optional)
String to append to the rewritten query. Must end in '='.

Default value: ''

大家谈论
    我的见解