When you register a post type, WordPress creates a query var for that post type which it uses in the process of parsing incoming requests and converting them into queries. In your case the query var is event
:
register_post_type( 'event', $args );
Your form then uses a POST
var of the same name:
$event = $_POST['event'];
So when you submit this form, WordPress sees the event
post var and thinks you are trying to query an event post with slug that matches that value, which is resulting in a 404.
The answer is to always prefix form vars with a unique string so they don’t clash with built-in or other plugin vars.
Related Posts:
- Custom post type and taxonomy same slug
- Change custom post type permalink according to category
- Some permalinks on Apache/localhost development setup return 404’s when set to anything other than plain permalinks
- How to create a permalink structure with custom taxonomies and custom post types
- How to structure a website with custom post types and custom taxonomies?
- Allow duplicate permalinks slugs for custom posts by different authors
- Issue with Custom Post Types and Permalinks
- How can i remove post type archive URL?
- Custom post type URL structure with site.com/custom_taxonomy_slug/post_name
- Page as parent for CPT and other pages
- Pagination not working (page/2 retunring 404 page)
- Permalinks change when edit published post on custom post type
- Two CPT: one is using part of the custom rewrite slug from the other
- How to redirect CPT permalinks from ID to default pretty permalinks?
- WordPress page not showing up – replaced with last 10 posts?
- Custom permalink rewrite rules – how do I fix this?
- Custom permalink with custom taxonomies for custom post type
- custom search form for custom post
- Creating custom post type relationships
- Custom post type slug as page slug
- Metabox messes up permalink
- Why did permalinks setting affect the pages?
- Links Image in “Catalog” Page to Posts
- Template hierarchy changes when custom post-type permalink leverages custom taxonomy
- Why does my plugin require a permalink reset after a new installation?
- Create custom YouTube-like permalinks for multiple custom post types
- Pretty permalink structure with multiple (AND OR) taxonomies
- How to retrieve custom post type permalink in another cpt?
- Associate custom CPT with another CPT’s taxonomy and rewrite permalinks
- Getting Custom post category from Form
- Submitting custom post from frontend,jQuery ajax, and custom validation – can’t find proper place to insert wp_insert_post()
- 404 custom post type
- Change the url of a custom post type to include taxonomy
- Permalinks for a custom post type – with a page template (custom query) and taxonomy archive
- Post Custom & Taxonomy 404 error
- how to use two permalinks for one custom post type based on categories
- Understanding the workflow of form creation plugin
- Custom post URLs
- WordPress custom post type rewrite rule matches all pages returning 404
- Custom Post Type Taxonomy – Permalinks generating, but posts not found
- Can I override the permalink/slug on creation
- Change wordpress url permalink structure to show authors posts
- How to have permalink structure based on taxonomy terms
- Multiple archives for cpt, taxonomies, terms
- Custom post type permalink issue [duplicate]
- Multiple custom post type and permalink issue
- Custom taxonomy in custom post type archive with pagination
- Same permalink structure for all post types?
- the_permalink() leads back to homepage
- Multiple post types or single post type with category taxonomy?
- How to add base permalink to custom posts?
- Custom Post type and Taxonomy in post URL error
- WordPress Permalink Custom Post type
- Custom post type with parent page? Possible?
- Get full control over custom post type url
- How to switch from custom post type URL to category URL?
- Hierarchical taxonomy in permalink structure
- Is it possible to have public posts in a non-public custom post type?
- How can I add a “fake” parent into the permalink?
- Custom Post Type + Category archive
- Custom Post Type with /%shop_name%/gallery/%gallery% permastruct?
- Remove sequential number from permalinks
- Front end page submission form does not attach custom post type
- Multiple Custom Post Type permalink issue
- Permalink of custom post type partly broken
- Custom Post Types and rewrite rules – One CPT works and a cloned one doesn’t
- How to create a petition like form based on custom post types?
- Permalinks when using Custom Post Type with static page for archive
- How to change permalinks to taxonomy and post type’s posts
- Custom Post Type Archive Links Not Working
- Custom Post Type Categories Not Maintaining URL structure any more
- Customizing the custom post type permalink
- How to retrieve the permalink for a specific (custom) term?
- Add category slug as class attribute in a link array
- Have two (permalinks) urls for a same custom post type
- change precedence of permalink for post_types?
- Custom post type child page 404
- Single page problem when permalink type changed
- Front-end form submission not creating post
- Remove Custom Taxonomy Slug only without removing Custom post type slug in permalinks
- Redirect permalinks after creating custom post types
- taxonomy term names in custom post type permalink structure
- Get post id of permalink for a specific custom post type?
- Permalink clashing with Custom Post Type rewrite rule
- Can’t make permalink of CPT work
- Custom Post Type Permalink
- Issue with permalinks for custom post type
- Adding 2 CPT with multiple custom taxonomies to permalinks
- Custom Post Type permalink not working on new posts
- URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php
- Parent cpt/child custom post type URL permalink relationship
- Custom post type using standard post categories results in 404 when viewing /cpt/category
- Forms with multiple element types using custom post types
- Displaying database table in backend of wordpress
- How to make nested custom post type slugs work
- Permalink Trouble with Custom Post Type
- Custom Post Type Permalinks Problem
- Problems with custom post type and hierarchical permalinks
- WordPress Custom Permalink Structure with Custom Post Type and Taxonomies
- Change Taxonomy Permalinks