You can change the date links by directly modifying the date_structure
:
function wpd_change_date_structure(){
global $wp_rewrite;
$wp_rewrite->date_structure="news/%year%/%monthnum%/%day%";
}
add_action( 'init', 'wpd_change_date_structure' );
Don’t forget to flush rewrite rules after the change.
WordPress will use this to generate the rewrite rules for incoming requests as well as URL output when using API functions like get_year_link
, so there’s no need for a filter.
Related Posts:
- Need help with add_rewrite_rule
- remove “index.php” from permalinks
- Rewrite Rule for Multilingual Website, Like qTranslate?
- Custom post type permalink endpoint
- permalink independent on the post’s name stored in the database
- Regex in add_rewrite_tag not accepting OR operators?
- Permalink/Pagination issue: Category base name same as page name
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- Using two permalinks for one post
- add_rewrite_rule with 3 or fewer matches?
- Permalinks for WooCommerce Categories and Subcategories
- Redirect short-form URL to long-form URL (post_id to post_id + post_name)
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- How to change URL structure for pagination pages?
- Rewrite url / permalink for default archive – yearly / monthly
- Rewrite rule never matching
- Child pages with same slug
- Permalinks, Rewrites, Get Variables, Oh My!
- Rewrite-Rules not working on a vhost, everything goes to index.php
- Change permalink for a single post entry
- rewrite_rule for custom post type doesn’t affect get_permalink
- Add ‘articles’ prefix before blog posts url without affecting pagination
- How to get wordpress link to fully evaluate when coming from facebook
- custom permalink/shortlink with base62 encoded post ID
- Page Attachment Permalink Structure based on Menu Order?
- query_vars in plugin not working?
- WordPress not respecting template hierarchy (fetches index.php instead of single.php or page.php)
- Call to a member function add_rule() on a non-object
- I need a custom permalink for my website
- Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?
- Re-write specific custom post type category URL to go to another page
- Rewrite Rule for default post type
- RewriteRule accepts numbers but not letters in tag
- Remove custom taxonomy base from URL
- Custom query var rewriting with only variable
- Date Archives’ Permalinks under Category folder
- Custom Permalink
- add_rewrite_rule not working for me
- Using WP Rewrite, but just not “getting it”
- Share same Slug for a Custom Post Type and 2 Taxonomies
- How to remove specific category from URL in WordPress
- Rewrite CPT permalinks and include WPML language
- Custom permalink for specific category
- Custom permalink leads to index page
- Rewrite rule intended for CPTs gives 404 for pages
- WordPress add_rewrite_tag working for Posts, but not working for Pages
- Need To Add Custom rewrite base url for individual user
- Permalink structure between 2 custom post types and a taxonomy
- Rewriting single post url; add_rewrite_rule problem?
- Permalinks only for posts
- rewrite rule to redirect to the most recent date permalink
- Custom rewrite rule ignored
- Permalink for PDF of article
- Problems with rewrite rule
- Order custom post type posts by custom field with pretty URL
- Adding URL prefix for foreign language support
- add_rewrite_rule – Page Slug from “/foo-bar/” to “/foo/bar/”
- Add custom query vars to pretty permalinks
- How can you create a Permalink structure on a WordPress site?
- How can I set up a secondary permalink structure?
- permalink and add_rewrite_rule – error 404
- How to Use metada Value in Url and is it possible? [duplicate]
- Safest way to create a custom permalink
- Rewrite Post URL so it is constructed from parent post url & child post url
- rewrite based slug standar post wp
- Adding custom query var to a single post without redirecting to its root slug
- Create different permalinks for same post
- remove SLASH on single_post but KEEP on categories and parent pages
- Multiple Taxonomy Items for Separate URLs
- Fire a code when permalinks updated
- .htaccess to redirect to a wp page
- Flush rewrite rules with scheduled event (cron)
- WordPress Multisite ABSPATH and get_home_path() to check for htaccess or web.config file
- Redirect page to homepage, keeping URL
- Add slug to default post permalinks ONLY
- Custom permalink question
- Added a prefix in URL permalink structure but the old structure still working!
- Permalinks Question: Adding a prefix ONLY in front of all posts with the ‘video’ post format
- how to have same rewrite rules for 2 different post type?
- Permalink structure /page/page/cpt-post gives 404 with pagination
- Custom Permlinks work, regular page permalinks don’t
- How to change the URL using rewrite rule in wordpress
- What permastrusture tags are generated out of the box right after creating custom post types and taxonomies?
- Rewrite posts url as they’re all children of a page
- a way to support totally different url structure
- Multiple Permalink Patterns for one page
- create user’s view profile link with username
- Pretty Filter URL
- Where is wordpress redirecting wp-admin/admin/dashboard to wp-admin and how to turn it off
- Added incorrect rewrite rule now getting an error
- Add Custom Pagination Permalink
- Prevent guessing slug
- Why doesn’t WP update my .htaccess file?
- Pretty Permalink for Search Queries Not Working
- ReWrite Permalink to New Permalink Nginx
- WordPress permalink still not working (error or not understood?)
- Only homepage working correctly, 404 error on everything else
- standard post with extra parameter brings permalink problem
- Add additional URL variations for a Post
- Standard Htaccess directives disappear by themselves