WordPress Snippets at WPcustoms

Set permalink settings in a function

set the permalink settings from the the functions.php file, rather than from the WordPress admin backend


/**
 * Snippet Name: Set permalink settings in a function
 * Snippet URL: http://www.wpcustoms.net/snippets/set-permalink-settings-function/
 */
      function wpc_set_permalink(){
          global $wp_rewrite;
          $wp_rewrite->set_permalink_structure('/%postname%/');
     }
     add_action('init', 'wpc_set_permalink');