[wp-hackers] 404 for nested page and custom post type

Alex Hempton-Smith hempsworth at gmail.com
Thu Oct 20 01:04:36 UTC 2011


Thanks John,

This works for me, but with some errors. (I am running in debug mode though)

If i use this:
'foo/bar/?$'   => 'index.php?pagename=foo/bar'

I am given the following errors:
Notice: Undefined index: 0
in /Users/hempsworth/Sites/localhost/wp-trunk/wp-includes/post.php on
line 3175
Notice: Trying to get property of non-object
in /Users/hempsworth/Sites/localhost/wp-trunk/wp-includes/post.php on
line 3171
Notice: Trying to get property of non-object
in /Users/hempsworth/Sites/localhost/wp-trunk/wp-includes/post.php on
line 3178

And then the content that's expected.

If I replace that line for this:
'foo/bar/?$'   => 'index.php?page_id=13'

It works fine. Any idea why I'm getting those debug messages?

- - - -
Kind regards,
Alex Hempton-Smith

www.alexhemptonsmith.com
www.twitter.com/hempsworth



On Thu, Oct 20, 2011 at 1:53 AM, John Blackbourn
<johnbillion+wp at gmail.com>wrote:

> On 20 October 2011 01:44, Alex Hempton-Smith <hempsworth at gmail.com> wrote:
> > Hi all,
> >
> > I have a custom post type set up, with the following permalink structure:
> *
> > example.com/people/my-post*
> > I also have two pages, one with the permalink *example.com/people* and a
> > child page at *example.com/people/new*
> >
> > I'm trying desperately to create a custom template for the child page,
> but
> > when I visit the page, I receive a 404 error.
> >
> > Clearly this is due to a rewrite mixup between the custom post type, and
> the
> > page.
> >
> > How do I manage this do you think?
>
> If you explicitly know the page URLs then you can override the rewrite
> rules for those particular pages. Here's what I use:
> http://pastebin.com/kTrU2C6G
> _______________________________________________
> 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