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 30 minutes.
| Video Content | Time |
|---|---|
| Introduction/Overview | 03:10 |
| Custom PermaLink Structure | 18:27 |
| Rewrite Rules Storage Mechanism | 08:43 |
Rewrite API – Overview of WP_Rewrite Class
Explore the videos for insights and tutorials on the Rewrite API – WP_Rewrite Class. This section comprises 2 modules with a combined duration of 18 minutes.
| Video Content | Time |
|---|---|
| Properties | 08:32 |
| Methods | 09: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 13 minutes.
| Video Content | Time |
|---|---|
| Deep dive into Rewrite Rules | 05:18 |
| Functions Used in Rewrite API | 03:10 |
| Working Example | 04:20 |
Rewrite API – Function and its structure demonstration
Explore the videos for insights and tutorials on the Rewrite API function and its structure demonstration. This section comprises 5 modules with a combined duration of approximately 32 minutes.
| Video Content | Time |
|---|---|
| Deep Dive into Custom Permalink Structure Pt 1 | 08:48 |
| Deep Dive into Custom Permalink Structure Pt 2 | 08:41 |
| Deep Dive into Custom Rewrite Rules | 05:26 |
| Custom Endpoints and Tags | 04:53 |
| Custom Feeds | 03: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/