You can set the permalink structure by calling on the set_permalink_structure()
method of the global $wp_rewrite
object.
add_action( 'init', function() {
global $wp_rewrite;
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
} );
Here’s a PHP < 5.3 version of the code in case you’re getting errors.
function reset_permalinks() {
global $wp_rewrite;
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%postname%/' );
}
add_action( 'init', 'reset_permalinks' );
Related Posts:
- Get the blog page URL set in Options
- Different ways to display title
- How Do I Programmatically Force Custom Permalinks with My Theme?
- date_i18n() issue
- WordPress Multisite: Have the same header and footer of main-blog on all sub-blogs
- Display site admin profile fields in header.php
- How to test for MU via functions.php?
- Same footer on all multisites blogs
- Excluding a page with a certain name from wp_page_menu
- Link won’t show using the_permalink();
- get_query_var() and permalinks
- How can I disable/hide certain themes in multisite?
- Change the template of multiple multisite pages at the same time
- Is it a bad practice to use switch_to_blog in the frontend?
- WordPress custom post type permalink: website.com/post-name/post-id
- Theme Development for WordPress Multisite Installation
- WordPress empty Nav Menu error
- multisite: global menu containing network site links?
- Acivate all themes multisite wide automatically
- Filter categories used with Custom Structure Permalink
- How to make permalinks update from code?
- Question regarding WP multisite feature
- Default Permalink Type to Postname
- How to set a page as homepage in stead of the newspages?
- Featured Image meta box not showing up
- Where do files uploaded via Media Manager get stored in MU?
- wordpress 404 not found after rewrtie the author link
- Issue On Displaying Pages with Post Name Permalink
- Issue on Getting Custom post type Thumbnail’s URL
- WordPress page/blog incorporated into static website
- How to allow users to create their own website within my domain? [closed]
- Different text on different sites in a multisite setup
- Only the latest post shows up on post page?
- How to make a theme unable to be used on a multisite network?
- Sample Theme Options page for Multisite – what to consider
- Get themes’s images path in WordPress Multisite
- How to remove permalinks links presents in each page of my site?
- Multi Site Setup, Child Themes, Getting Style Sheet Directory
- Converting a theme to a child theme in a network
- HTTP Error when uploading images over specific dimensions
- If I remove Category base from my URLs, how difficult will rollback be?
- What are the permalinks options for “Category” base and removing it?
- How to get blog-id of an MU site from functions.php
- How do I open a post in a custom page in wordpress?
- Does single webpage do not need navigation to create a slug in permalink?
- Getting post URL within custom content template
- fetch all post from wp multisite network and sort all the post in descending order on the basis of “Created by ” term
- How to get full native language instead of iso?
- How to make menus, footer, sidebars multi language
- Why does the theme of secondary site load the primary one in WordPress Multisite? [closed]
- Let user publish posts on community page
- How to hide blog by id wordpress multisite listing
- Can I use WP Multi-site on a sub-domain with a different theme but use all the original site’s posts/pages?
- Mutlisite in wordpress is not working
- background_image support multiple image size?
- How can I demonstrate themes well?
- Theme Options Doesn’t Work On WP Multisite
- Mamp pro permalink issues. Pages keep reverting to index.php
- Subsite theme mystery man replacement with Buddypress on main site [closed]
- Custom link color or stylesheets
- Permalinks problem with custom theme
- Permalink Setting Changes From Post Name to Default After Changing The Page Name
- Configuring static page with add_rewrite_rule gives 404 after navigating to Permalinks admin panel
- Menu items description? Custom Walker for wp_nav_menu()
- How to define and link full path to css located at a random folder on header.php
- Sizing screenshot.png without losing aspect ratio
- Software for WordPress Theme and Plugin Development? [closed]
- When to use is_home() vs is_front_page()?
- What is the preferred way to add custom javascript files to the site?
- How to create .pot files with POedit?
- How do I get the theme URL in PHP?
- Why when I submit a form in wordpress it loads a 404 page though URL is correct
- What is the constant WP_USE_THEMES for?
- Worthwhile to restrict direct access of theme files?
- How Do I Protect My Premium WordPress App Theme from Copying?
- How to detect mobile devices and present them a specific theme?
- Using wp_add_inline_style without a stylesheet
- How to add posts to custom menus?
- WordPress Theme Preview Image
- How To extend WP_Customize_Control
- What is the difference between front-page.php and home.php? [duplicate]
- How can I get page slug
- Does the functions.php file ever get called during an AJAX call? Debug AJAX
- When to use _e and __ for the translation?
- What is a Theme textdomain?
- How to show a custom meta box on the “Quick Edit” screen?
- How to add CSS class to custom logo?
- How to add custom css file in theme?
- How important is it to enqueue a theme’s stylesheet?
- CSS not updating in browser when I change it
- Display Search Result Count
- wp_nav_menu(), how to change class?
- theme path in javascript file
- Remove the blog slug from WordPress Multisite root node
- Is wp_is_mobile() effective?
- Display Menu Name using wp_nav_menu
- Making update notification functionality for my themes
- What questions do you ask when asked to give an estimate on theme development?
- How to remove dashicons.min.css from frontend?
- How do I remove a pre-existing customizer setting?