You would place this code inside your theme’s functions.php file. It shouldn’t really matter where in the file that you place it.
Related Posts:
- Archive permalinks
- Permalinks for WooCommerce Categories and Subcategories
- Rewrite url / permalink for default archive – yearly / monthly
- Change of permalink structure – redirects in htaccess breaks the archive links
- Custom permalink for search and pagination
- Programatically changing post’s permalink when identical post type is published
- Date Archives’ Permalinks under Category folder
- Can’t select blog month within archive category
- Advanced author permalinks
- Disable date based archives for all categories except one
- Path to Pages Resolves to Archive instead of Actual Content
- permalinks issue and archives
- Change permalink structure for pagination only
- I Need to use Month , year in my all archives and pages of my wordpress site
- Strip subcategory base from URL
- archive by year and category: permalink support doesn’t work on pagination
- Customize URL for specific tags archive
- Permalinks – Archives
- WordPress Archives Cause Looping
- Permalink, links a page to the homepage
- Permalinks of archive tag wordpress
- WordPress archive posts returns user to homepage
- Post archive pages bringing me to a 404 page
- Get the current page URL (including pagination)
- What is the difference between get_post_permalink and get_permalink?
- WordPress matching URLs with trailing tildes
- Rewrite Rule for Multilingual Website, Like qTranslate?
- How to use relative links on my pages?
- How to filter to output of the get_permalink() function
- Is there a user-facing interface to edit an attachment’s permalink?
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- Custom Permalink: /year/month/post-goes-here/?
- Get post title with link
- Menu Link Redirect Based on Username or User ID
- Redirect short-form URL to long-form URL (post_id to post_id + post_name)
- Does a parent page’s post_title have to appear in a child page permalink?
- Enable Minify in W3Total Cache using NGINX [closed]
- How to make variables in URL look like the permalink structure?
- Why I can’t change the permalink of this page?
- Sub-category and category in permalink structure
- Permalinks changed with WordPress 4.9
- Permalinks broken regularly
- How can I add a page’s ID to its permalink using WP_Rewrite?
- How to change the permalink option to post name on theme activation?
- Does rename of page slugs create 301 redirects from old slug to new (same as for posts)?
- Changing post content on save, using updated fields
- Change blog segment of URL
- Change in permalink structure made javascript cookie not work correctly
- Making permalinks to /%postname%/ by default in installation
- Multiple taxonomies on same permalink rule [closed]
- How to bulk edit image url in featured image and product description?
- What’s actually happening when permalinks for custom post types suddenly stop working
- Images in media library have suddenly disappeared
- Post with Custom Permalinks
- Conditional permalink structure
- Auto setup “permalink” or request notice
- How to add .html to the end of the permalink
- How to use all tags in post permalinks
- Stop Images Linking to Themselves?
- Remove parent page from url
- Remove “attachment/” from the URL of attachment pages
- Inserting a string in the middle of page’s permalink?
- 404 on internal pages, in all sites in my local server
- how to alter permalink in wordpress?
- Adding User Info to Permalink of User pages – is it neccessary?
- Pagination using paginate_links
- add_rewrite_rule – Page Slug from “/foo-bar/” to “/foo/bar/”
- Permalink will not change – it wants to have -2 slug [duplicate]
- Permalinks 404 after Subdirectory to Root Migration
- Access or edit custom generated permalinks with WP_Rewrite
- Add custom query vars to pretty permalinks
- Custom permalink structure only saves with index.php inserted
- Two custom taxonomies in permalink structure
- the_permalink() not working
- All in One Seo and Permalinks
- Already have htaccess but permalink settings not working. Getting 404
- How to update wordpress permalink structure with author role?
- How to turn a custom query string into permalink?
- How can i fix my permalinks?
- Adding custom query var to a single post without redirecting to its root slug
- Custom structure permalink preventing 404
- Flush rewrite rules with scheduled event (cron)
- I have a 404 error on all my pages! What do I do?
- All files in public_html, Cannot launch WordPress site via wp-admin
- Add slug to default post permalinks ONLY
- Propper way to set anchor and url param
- Do shortcodes in title before permalink is generated
- How to change dynamic link to relevant post
- Auto-generated pretty permalink not using title since 4.4 update
- Pretty permalinks returning “not found” on localhost and server
- Removing or hiding slug/permalink from htaccess
- Problems with permalinks after update wordpress 4.2
- WordPress Permalink Problem
- Latin character conversion
- Update permalinks
- Losing the original URL when using add_rewrite_rule
- broken permalinks in responsive layout
- Permalink issues with Ubuntu Server – Infinite loop & Wrong pages
- How to get the perfect WordPress, WooCommerce, Custom Post Type pretty permalinks?