23 December 2013

Set permalink settings from functions.php

Use this code to change the permalink settings from your functions.php file.

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');
?>

No comments:

Post a Comment