[wp-testers] Custom Post Types and Permalinks

Andrew Nacin wp at andrewnacin.com
Mon Feb 14 02:52:17 UTC 2011


On Sun, Feb 13, 2011 at 9:40 PM, Jason Bobich <jason_bobich at hotmail.com>wrote:

>
>
> > > I did try flushing re-write rules. As I said, I even went to the extent
> of
> > > installing a fresh WordPress 3.1RC4 on a new db, and all I did was
> install
> > > my theme,  turn on permalinks, and create a post (using the custom post
> > > type). I did this on both my live web server and on my local machine
> (using
> > > MAMP). Same thing happens.
> >
> >
> > Your custom post type doesn't actually register any permalinks. The
> rewrite
> > flag is missing, and by default it is false. A link such as
> > ?portfolio-item=blah might work, but /portfolio-item/blah will not.
>
> I see here in the codex that the rewrite is true and takes on the slug by
> default.
>
> http://codex.wordpress.org/Function_Reference/register_post_type#Arguments
>
> Is the rewrite attribute being false by default new to 3.1? That would
> definitely explain the problem.
>

My bad, it is true by default. What it isn't is public by default. (Why
you'd ever want public = false, but rewrite = true is beyond me.)

Anyway, your code (when attached to the init hook) worked for me, once I
ensured that the rewrite rules were flushed.

Nacin


More information about the wp-testers mailing list