Create second custom 404 page for selected post type

I created a new custom post type called event, which works fine.

I also created a custom 404 page template, which is shown if a event/page/post is not found.

Read More

But now the hard part, i want to create a custom 404 page for event post type. So this 404 page is only shown if a event is not found. But the default 404 page should still work with posts or pages.

Thanks

Related posts

Leave a Reply

1 comment

  1. Two options:

    1. Use conditional code inside of 404.php, to output different content/markup for the post-type
    2. Intercept the template at template_redirect, and include a separate template file for a 404 for the post-type.

    Personally, I’d go with option 1, as it is easier and more intuitive.