Rewrite API

WordPress allows theme and plugin developers to programmatically specify new, custom rewrite rules. The following functions (which are mostly aliases for WP_Rewrite methods) can be used to achieve this.

Rewrite API – Overview

Explore the videos for insights and tutorials on Rewrite API Overview. This section comprises 3 modules with a combined duration of 38 minutes.

Video ContentTime
Introduction/Overview03:10
Custom PermaLink Structure18:27
Rewrite Rules Storage Mechanism08:43

Rewrite API – Overview of WP_Rewrite Class

Explore the videos for insights and tutorials on Rewrite API – WP_Rewrite Class. This section comprises 2 modules with a combined duration of 20 minutes.

Video ContentTime
Properties08:32
Methods09:27

Rewrite API – Rules

Explore the videos for insights and tutorials on Rewrite API – Rules. This section comprises 3 modules with a combined duration of 37 minutes.

Video ContentTime
Deep dive into Rewrite Rules05:18
Functions Used in Rewrite API03:10
Working Example04:20

Rewrite API – Function and its structure demonstration

Explore the videos for insights and tutorials on Rewrite API – Function and its structure demonstration. This section comprises 5 modules with a combined duration of 53 minutes.

Video ContentTime
Deep Dive into Custom Permalink Structure Pt 108:48
Deep Dive into Custom Permalink Structure Pt 208:41
Deep Dive into Custom Rewrite Rules05:26
Custom Endpoints and Tags04:53
Custom Feeds03:49

Ideas to Explore:

  • What is the role of rewrite rules in WordPress? How does WordPress use it?
  • Suppose two rewrite rules (the regex) are matching the current URL then which one will be selected?
  • Are rewrite rules site-specific or network-specific in the case of multisite?
  • When to use flush_rewrite_rules?
  • What is ep_mask? Where can we use ep_none?
  • What is the difference between flush_rules and flush_rewrite_rules?
  • How can we remove the category prefix from URLs? Eg https://my.site/category/abc/ should appear as https://my.site/abc/