It seems like what I want is something that WordPress’s internal permalink code isn’t prepared to deal with. After reading this writeup by Otto, I’ve come to understand that having my permalinks start with %category% could create a performance issue down the road and I would have to create a function that further alters the WordPress permalink rules in order to get the attachment permalinks working with %category%.
As a result, I’ve decided to start all my posts with the year. This allows me to use the solution found here for attachment permalinks, and I’ll avoid performance headaches in the future.
Related Posts:
- Image Attachment Url Rewrite
- Attachment Page Permalink/URL Rewrite Issue. How to change the actual rewriting?
- Change permalink to attachment
- WordPress Attachment Page URL Rewrite!
- Need help with add_rewrite_rule
- remove “index.php” from permalinks
- How do I add /blog/ as a prefix to permalink structure for blog posts, tag pages, etc.?
- Passing and retrieving query vars in wordpress
- Permalink format: singular or plural
- How does WordPress handle permalinks?
- Pretty permalinks for search results with extra query var
- How to get pretty URLs with add_query_arg in permalinks
- Creating custom permalink structure for languages
- Custom post type permalink endpoint
- How to remove dates from existing permalinks?
- Getting the Site URL Including the Front Base
- Using $_GET variables in the URL?
- Stop WordPress from reserving slugs for media items?
- Including category-base in a post permalink results in 404
- WordPress thinks my custom route is a 404
- Date based URLs for custom posts and pagination
- How to add a custom URL placeholder to author archives?
- How to custom change author base without $this->front?
- URL rewrite based on a custom field value
- Update URL Snippet to Canonical Permalink URL
- How to prevent the default home rewrite to a static page
- “.#[random-char-string]” being inserted at end of URLs
- How to change author base without front
- permastruct for custom post type not working in one of four cases
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- Pretty Permalinks
- Make post slug have priority over category slug
- Remove parent slug for child pages
- How to create a permalink structure for posts in a specific category
- How to remove the index.php in the url?
- Post being redirected to attachment post
- How to map permalinks with accented letters to sanitized slugs?
- Remove subfolders from URL
- Remove parent slug for child pages
- Add custom directory in URL
- Using two permalinks for one post
- flexible rewrite ‘ramble’ URLs with WordPress
- How can I Rewrite a ‘page’ URL based on query string parameters?
- Custom rewrite rules for a $_GET request
- Nice RSS Feed URLs for each custom post type
- Change the custom post type permalink
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- custom naming of search permalink /search/
- Auto 301 to full post permalink? (using /posts/%post_id%/%postname%)
- Put post ID on the custom post type URL
- Rewrite url / permalink for default archive – yearly / monthly
- Rewrite user profile URL to be human friendly
- Is it possible to list post attachments in a sub URL endpoint with a dedicated template?
- Random Alphanumeric Key URLs
- Permalinks, Rewrites, Get Variables, Oh My!
- Using WP rather than .htaccess to redirect pages/posts
- Change permalink for a single post entry
- Remove the Parent category from the permalink but leave the child category
- How to Modify Existing Rewrite Rules?
- Rewrite URL for results of a custom WP_Query
- Rewrite URL Parameter And Force ‘Pretty’ Permalink
- rewrite_rule for custom post type doesn’t affect get_permalink
- Add ‘articles’ prefix before blog posts url without affecting pagination
- Attachment page 404 not found when image is attached to post
- Apostrophe in permalink results in page not found
- custom permalink/shortlink with base62 encoded post ID
- How to replace “wp-content/blogs.dir” with “media” for attachment permalinks?
- Change permalinks with ACF values
- Adding File Extensions to Attachment Page Permalinks
- template_include not loading -instead goes to index.php
- Rewrite Page with a slug before page name
- Can’t get rewrite rules working
- Multilanguage URLs
- Rewrite my default post URL
- Incorrect 404 for pages when using permalink, a static front page, and posts page
- Page Attachment Permalink Structure based on Menu Order?
- add new permalink structure from dynamic page
- Custom attachment permalink structure [closed]
- When is it a good idea to build a permalink structure from scratch?
- WordPress not respecting template hierarchy (fetches index.php instead of single.php or page.php)
- How to improve WordPress security by hiding non public facing files?
- If the only permalink setting is %postname% what happens in the case of old duplicates?
- Call to a member function add_rule() on a non-object
- Custom taxonomy rewrite using tax name instead of rewrite slug
- I need a custom permalink for my website
- Change author slug and functionality
- How to reset canonical URLs / fix redirect loop
- Why does chrome keep downloading a file instead of running the site?
- How can I add a page’s ID to its permalink using WP_Rewrite?
- Permalinks: Page Not Found
- Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?
- Re-write specific custom post type category URL to go to another page
- Use Regular Expression to get tag from permalink url during wp_rewrite in generate_rewrite_rules
- Is it possible to keep all special letters for foreign languages in slug as in title?
- Does changing a post title of a published post automatically change permalink?
- Change blog segment of URL
- Remove custom taxonomy base from URL
- remove sub-category of Custom Post Type from permalink structure
- WordPress Permalinks & Nginx Rewrite Rule Not Working
- Add custom post type name in term link?