Tags::rewrite_rules( array $rules, string $slug, int $base_page_id )
Description #
Add category pages rewrite rule.
Parameters #
- $rulesarray (Required) AnsPress rules.
- $slugstring (Required) Slug.
- $base_page_idint (Required) AnsPress base page id.
Source #
File: addons/tags/tags.php
public function rewrite_rules( $rules, $slug, $base_page_id ) { $base_slug = get_page_uri( ap_opt( 'tags_page' ) ); update_option( 'ap_tags_path', $base_slug, true ); $lang_rule = str_replace( ap_base_page_slug() . '/', '', $slug ); $lang_rewrite = str_replace( ap_opt( 'base_page' ), '', $base_page_id ); $cat_rules = array( $lang_rule . $base_slug . '/([^/]+)/page/?([0-9]{1,})/?$' => $lang_rewrite . 'index.php?question_tag=$matches[#]&ap_paged=$matches[#]&ap_page=tag', $lang_rule . $base_slug . '/([^/]+)/?$' => $lang_rewrite . 'index.php?question_tag=$matches[#]&ap_page=tag', ); return $cat_rules + $rules; }
Expand full source code Collapse full source code View on GitHub: addons/tags/tags.php:540
Add your comment