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?
- How to add a custom URL placeholder to author archives?
- Permalink/Pagination issue: Category base name same as page name
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- Make post slug have priority over category slug
- Custom Rewrite with Query vars
- Using two permalinks for one post
- flexible rewrite ‘ramble’ URLs with WordPress
- add_rewrite_rule with 3 or fewer matches?
- Permalinks for WooCommerce Categories and Subcategories
- Change the custom post type permalink
- 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
- Rewriting permalinks with custom posts
- 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
- How to Modify Existing Rewrite Rules?
- 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?
- When is it a good idea to build a permalink structure from scratch?
- 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
- 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
- How to add_rewrite_rule with two parameters to a single view page?
- Rewrite Rule for default post type
- how to add rewrite rule to wordpress 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
- remove sub-category of Custom Post Type from permalink structure
- add_rewrite_rule not working for me
- Is a permastruct possible on pages?
- Using WP Rewrite, but just not “getting it”
- Rewrite rule for a query string
- How do I add /blog/ as a prefix to permalink structure for posts, categories & tags?
- 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
- Redirect Uploads Folder to Query Vars in WordPress
- 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
- Rewrite URLs for LeadPages due to subdirectory installation
- 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
- How to change “attachment_id” in attachment permarlink?
- Custom rewrite rule ignored
- How to test custom rewrite rules /permalinks?
- wordpress how to replace url /bar with foo/bar for custom post type
- Remove some rewrite rules in wordpress
- Permalink for PDF of article
- Problems with rewrite rule
- Getting back a permalink from custom url
- Order custom post type posts by custom field with pretty URL
- Adding URL prefix for foreign language support
- add_rewrite_rule on default post type
- Exclude single page from permalink rule
- help to remove last trailing slash using add_rewrite_rule
- 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?
- Rewrite rule not passing variable
- 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
- corrupted URLs – can’t leave starting page
- 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)
- Multiple URL rewrite rules and get every prams