title: How to change Wordpress' default posts permalinks programmatically?
body: <p>In the backend of Wordpress I use the default <code>http://localhost/sitename/example-post/</code> value for creating permalinks.</p>
  
  <p>For custom post types I defined a custom slug this way, here is <code>services</code> for example:</p>
  
  <pre><code>register_post_type( 'service',
      array(
          'labels'      =&gt; array(
              'name'          =&gt; __( 'Services' ),
              'singular_name' =&gt; __( 'Service' )
          ),
          'public'      =&gt; true,
          'has_archive' =&gt; true,
          'rewrite'     =&gt; array(
              'slug'       =&gt; 'services',
              'with_front' =&gt; true
          ),
          'supports'    =&gt; array(
              'title',
              'editor',
              'excerpt',
              'thumbnail'
          ),
          'taxonomies'  =&gt; array( 'category' ),
      )
  );
  </code></pre>
  
  <p>It creates <strong>services/post-name</strong>. </p>
  
  <p>I also use this hook to create a custom page to create a custom page permalink:</p>
  
  <pre><code>function custom_base_rules() {
      global $wp_rewrite;
  
      $wp_rewrite-&gt;page_structure = $wp_rewrite-&gt;root . '/page/%pagename%/';
  }
  
  add_action( 'init', 'custom_base_rules' );
  </code></pre>
  
  <p>It creates <strong>page/post-name</strong></p>
  
  <p>Now the only thing I need to do is to create another custom permalink path for the normal Wordpress <strong>posts</strong>.</p>
  
  <p>So the outcome world be for the post type of <code>post</code>: </p>
  
  <p><strong>post/post-name</strong></p>
  
  <p>I can't use the backed for this because I already defined a default way of handling the permalinks. I already managed to rewrite the paths of custom post types and pages...</p>
  
  <p>How do I rewrite the normal <code>post</code> post type permalink path in Wordpress programmatically?</p>