An optional member of the custom post type configuration is the rewrite parameter. It can be defined as follows:
'rewrite' => array( 'slug' => 'awesome-book-reviews' )
Although this may seem very simple, the permalinks will only change over after you go to the Permalinks section and Save Changes, as we did in the recipe. Alternatively, it is possible to make calls from the WordPress rewrite module to programmatically request for the permalinks configuration to be rebuilt. As this is not something that should be done every time WordPress displays a page, but would be too early to do when a plugin gets initialized or upgraded, a good place to call these functions would be within the plugin options storage function. You might even decide to give administrators the ability to specify their own slug in a plugin configuration page. The code to reset the permalinks rules is as follows:
global $wp_rewrite;
$wp_rewrite->flush_rules();