Permalink settings are available in the WordPress admin settings. Sometimes you may not have the access to WordPress admin and you want to set permalinks settings from functions.php.
Instructions: Add the following code to the functions.php file of your WordPress theme.
The .htaccess mod_rewrite
it is still necessary.
<?php // set permalink function set_permalink(){ global $wp_rewrite; $wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%postname%/'); } add_action('init', 'set_permalink'); ?>
You may also enjoy flushing permalinks once per hour cron job.
Is this function also working in a multisite install?