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
- How do I add /blog/ as a prefix to permalink structure for blog posts, tag pages, etc.?
- Permalink format: singular or plural
- Pretty permalinks for search results with extra query var
- How to get pretty URLs with add_query_arg in permalinks
- Custom post type permalink endpoint
- Using $_GET variables in the URL?
- URL rewrite based on a custom field value
- How to change author base without front
- How to create a permalink structure for posts in a specific category
- Post being redirected to attachment post
- How to map permalinks with accented letters to sanitized slugs?
- Add custom directory in URL
- Using two permalinks for one post
- Custom rewrite rules for a $_GET request
- Nice RSS Feed URLs for each custom post type
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- Put post ID on the custom post type URL
- Rewrite url / permalink for default archive – yearly / monthly
- Random Alphanumeric Key URLs
- Permalinks, Rewrites, Get Variables, Oh My!
- Change permalink for a single post entry
- Remove the Parent category from the permalink but leave the child category
- Apostrophe in permalink results in page not found
- Change permalinks with ACF values
- Can’t get rewrite rules working
- Multilanguage URLs
- Rewrite my default post URL
- When is it a good idea to build a permalink structure from scratch?
- I need a custom permalink for my website
- How to reset canonical URLs / fix redirect loop
- Permalinks: Page Not Found
- Does changing a post title of a published post automatically change permalink?
- Remove custom taxonomy base from URL
- Add custom post type name in term link?
- Is a permastruct possible on pages?
- Rewrite rule for a query string
- How to add a variable as a tag base?
- WPML – how to get the permalinks to display also the default language
- How can i have a custom post type with more slugs for each post?
- URL rewriting: removing the site’s basename for a specific category
- How can I get this custom post type permalink structure? %custom_post_type%-%taxonomy%-%term-postname%
- Rewrite rule intended for CPTs gives 404 for pages
- Unable to get /%postname%/ permalinks working, 404 on all links
- Permalink structure between 2 custom post types and a taxonomy
- 404 error using Meta for Permalink rewrite
- Disable date based archives for all categories except one
- How to rename ‘Tag Base’ with WPeC 3.8?
- Custom rewrite rule ignored
- How can I emulate permalink behaviour on static pages
- How to handle paging/pagination with a custom permalink?
- Media/attachment urls don’t redirect with fake URL structure
- Remove parent page from url
- Remove “attachment/” from the URL of attachment pages
- Custom URL rewrites for templates
- How to change custom post type, blog post and page permalink by template?
- add_rewrite_rule – Page Slug from “/foo-bar/” to “/foo/bar/”
- WordPress pages and posts are redirecting to server IP address instead of domain URL [closed]
- Access or edit custom generated permalinks with WP_Rewrite
- optional parameter in permalink structure
- Rewrite rule not passing variable
- How to get raw unwritten querystring
- “set_front” => false on custom post type breaks wp_list_categories links [closed]
- All in One Seo and Permalinks
- Custom child page permalink
- Safest way to create a custom permalink
- Creating an alternate path for a page
- rewrite based slug standar post wp
- How to change URL from /%postname%/ to custom-name/%category%/%year%/%monthnum%/%day%/%postname%/
- remove SLASH on single_post but KEEP on categories and parent pages
- Adding a ‘blogs’ prefix in the URL structure but only for blogs
- Extra url paths as variable
- WordPress Multisite ABSPATH and get_home_path() to check for htaccess or web.config file
- Add slug to default post permalinks ONLY
- Permalink structure /page/page/cpt-post gives 404 with pagination
- a way to support totally different url structure
- Multiple Permalink Patterns for one page
- Pretty Filter URL
- How to change URL of my pages?
- Dynamically populate permalinks
- Converting WP Page to use full explicit paths?
- Prevent guessing slug
- Once redirected by Rewrite rules, how can WordPress know the page?
- Customize category permalinks
- Update permalinks
- Losing the original URL when using add_rewrite_rule
- Custom Permalink Base
- My wordpress site must be being affected by outside sources [duplicate]
- URL to an image in a post is changing when permalink is set to custom. Can I avoid this?
- Create a permalink for a post’s attachments
- Permalinks, how to show them in post
- permalinks url with woocommerce
- How to get the perfect WordPress, WooCommerce, Custom Post Type pretty permalinks?
- Blog url disappears
- Add additional URL variations for a Post
- How to make my custom permalink pull up the correct post