[wp-hackers] Putting WordPress posts in different Permalink Structure, to Custom Post types

John Blackbourn johnbillion+wp at gmail.com
Sun Feb 13 21:54:15 UTC 2011


Hey Robert,

There is an optional argument in the 'rewrite' array called
'with_front'. Set this to false and the /news/ section won't be used
in your custom post type URLs.

There are a couple of other arguments too in the rewrite array that
you might be interested in. See
http://codex.wordpress.org/Function_Reference/register_post_type#Arguments
(scroll down to the rewrite section).

John

On 13 February 2011 19:11, Robert Lusby <nanogwp at gmail.com> wrote:
> Hello,
>
> How do you set the rewrite slug of a standard WordPress post (but not affect
> other Custom Post Types)?
>
> In more detail:
>
> We've been running an install of WordPress at http://www.example.com.
>
> We use the "Post" function to run the news section of the site, therefore we
> configured Peramlinks (in Settings) to use: /news/%postname%-%post_id%.
>
> However we now have a custom post type called "events", we've set the
> rewrite slug for this to be events: ['rewrite' => array('slug' =>
> 'webcasts')]
>
> The problem being - the permalink setting is now causing URL's such as
> http://www.example.com/news/events, when it should be
> http://www.example.com/events.
>
> Obviously removing /news/ from permalinks solves the problem, but then
> leaves Posts without the /news/ sub-structure.
>
> How do you set the rewrite slug of a standard WordPress post (but not affect
> other Custom Post Types)?
>
> Thanks,
> Rob
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list