Set Permalink Structure Function
add_action( 'init', function() { global $wp_rewrite; $wp_rewrite->set_permalink_structure( '/%postname%/' ); } );