Description: WordPress plugin that registers a movie CPT with custom permalinks (/movies/%genre%/%postname%/), a reviews endpoint, year archive rewrite rule and a custom feed /feed/movies.
- Custom Post Type:
movie - Taxonomy:
genre - Custom permalink with
%genre%replacement - Endpoint:
/reviews/for single movie - Rewrite rules:
/movies/year/<YEAR>/,/movies/genre/<slug>/ - Custom RSS feed:
/feed/movies
- Clone this repo into
wp-content/plugins/:cd wp-content/plugins git clone https://github.com/<your-username>/movies-rewrites-demo.git
- Endpoint:
/behind-the-scenes/ - Purpose: Demonstrates
EP_NONEusage with customadd_rewrite_rule(). - How it Works:
- EP_NONE means the endpoint is not automatically attached to WordPress default locations.
- A manual regex rule is added to map the URL to the correct movie post.
- Example URL:
/movies/action/the-avengers/behind-the-scenes/ - Shows a "🎥 Behind the Scenes" section for the selected movie.
add_rewrite_endpoint('behind-the-scenes', EP_NONE)add_rewrite_rule()for matching/behind-the-scenes/URLs.- Logic in
template_redirecthook to display endpoint content.
- Go to Settings → Permalinks → Save Changes to flush rules.
- Visit a movie URL with
/behind-the-scenes/at the end.