首页 WordPress函数大全 add_rewrite_rule()

add_rewrite_rule()

2020-05-01 / 4650阅 / 悠然

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

add_rewrite_rule( string $regex, string|array $query, string $after = 'bottom' )

Adds a rewrite rule that transforms a URL structure to a set of query vars.

描述

Any value in the $after parameter that isn’t ‘bottom’ will result in the rule being placed at the top of the rewrite rules.

参数

$regex

(string)
(Required)
Regular expression to match request against.

$query

(string|array)
(Required)
The corresponding query vars for this rewrite rule.

$after

(string)
(Optional)
Priority of the new rule. Accepts 'top' or 'bottom'.

Default value: 'bottom'

大家谈论
    我的见解