Got a small problem and wonder if someone can help me with this. So when we started building the current website, all posts where living in the root ie http://somedomain.com/post-slug-here Now we added a custom post type called discussions and the client decided that they would like the posts as http://somedomain.com/articles/post-slug-here and the discussions as http://somedomain.com/discussions/discussion-slug-here. So we set the permalinks to Custom Structure and set them to /articles/%postname%/. This works for articles but not for discussions. They appear as /articles/discussions/discussion-slug-here/. Does anyone know how to fix this?
your saying the problem yourself. you want this. http://somedomain.com/articles/post-slug-here and the discussions as http://somedomain.com/discussions/discussion-slug-here. Yet your Permalink is setup as /articles/%postname%/. and now you wonder why it shows as /articles/discussions/discussion-slug-here/ thats because you put the word articles in the permalink structure so if you removed it than it would show as /discussions/discussion-slug-here/ but then your articles may not work
That's correct. As soon as I remove the articles from the permalink structure the articles are again the the root. This will cause the url's to look like this http://somedomain.com/uncategorised/postname/ http://somedomain.com/discussion/postname/ So close but still not quite there. Anyone else got any ideas?
Right I managed to fix it. 'rewrite' => array('slug' => 'discussion','with_front' => false), PHP: the with_front => false does the magic. and for the articles I set the permalink to /articles/%postname%/
I realize this may not help mid-production, but for anyone else, what I do... I use a free plugin [WP-Types] to create any custom post types, and during the process I have the ability to set the permalink structure (or, it defaults to the "slug" of the CPT anyways, so no need to go custom, but the option is still there). Then, the rest of the site remains as is. Hope this is helpful!