Its pretty much what you already have, just add the following after $pid = wp_insert_post($new_post);
:
#categories
if( !empty ( $_POST ['categories'] ) ){
update_post_meta ( $pid, "_testimonials_category", stripslashes ( $_POST ['categories'] ) );
}
I would probably advise you to change the name of this from categories though to something more relative, like testimonials_categories
Then you can use:
$chosen_testimonial_category = get_post_meta($pid,'_testimonials_category',true);
As for validation, check out jQuery.validate
Related Posts:
- Front end page submission form does not attach custom post type
- Reason action hook won’t work with update_post_meta from frontend form? Alternative?
- How to make front end form only accept certain values
- Better approach for a WordPress Inventory
- create category upon saving post and save post in that category
- How to add categories to a custom post type using wp_insert_post($new_post);
- Submit post and upload image from front-end
- Exclude a category from WP_Query
- Custom Post Types on Category Pages
- Adding Categories to a WordPress Custom Post Type?
- How to display regular posts & custom post types that fall under a category using just the generic category template?
- How to filter custom post types by custom category taxonomy
- How to list all categories and tags in a page?
- Pagination not working with custom category template
- List custom post types in dropdown
- remove support for ‘Categories’ for a custom post type
- Remove date and category filters when editing custom post types
- Saving two categories from two dropdowns in front end posting form
- Filter get_categories() for taxonomy term in WordPress
- Anyway to assign custom post types to a specific category?
- List with categories, subcategories and posts of custom posttype
- wp_list_categories and custom post types
- front end radio custom taxonomy with custom post type
- Automatic category for a Custom Post Type
- How can i list custom post type categories?
- Query Custom Post by Category
- How to display the categories of the post? (custom post type)
- Display Custom Category (taxonomy) Name in Custom Post Type
- CPT posts listed by category with custom rewrite URL, please help!
- WordPress Create Post from front-end
- Multiple custom post type loops in category.php
- Add category in post type dynamically
- How to get the post type from a category id?
- Insert HTML inside link in a walker
- Use regular category with custom post types
- Set menu active state for custom posttype and category, given custom taxonomy term
- Send email button in custom post type backend
- How to query custom post types posts filtered by multiple custom taxonomies through a form selection
- Getting posts under the custom post type ui category
- Separate custom categories from default category
- How to display custom taxonomies with links in filter menu?
- Cannot add category or custom taxonomy from admin. WordPress site is hosted in Windows 16 server via IIS. No XAMPP or WAMP
- Add custom post type settings to wordress default posts
- Hide parent categories when clicked, and show it’s childs
- Custom post type, organized by categories
- Remove CPT name from permalink but add %category% instead
- Set a checkmark in a category based on a URL-parameter
- Multiple (two) category postings on the same page.
- School & class blogs: Categorize with categories or custom posts?
- How to get custom posts sub category link
- Categories filtering in new post
- CPT category hierarchy
- How To Import CPT With Only Few TEXT ACF Fields From Front End?
- 404 Error on form submission within custom post type
- Can I restrict category availability?
- get_category_link() for custom post type does not include custom slug rewrite?
- Targeting categories in custom fields
- Assigning a category to a custom post type in WordPress
- Stores category posts in an array
- category list with cutom post count
- Get category if used in a custom post type
- Get admin area editor in frontend
- custom query with custom post type and category slug
- Custom post type categories gives 404 error
- Direct form to a custom page template
- Post visibility option to theme front-end for author to select?
- display custom portfolio tags
- Post category behave like a Post in back office menu
- Save data is post using php front end
- How to output custom post type title on custom page with category next to it?
- In the php, how can I have a category of a custom post type display?
- Attend event form with ajax
- Pagination for a cpt filtered with a category
- assign array of category to custom post type
- How to manage a dynamic multi-level page hierearchy system?
- Custom Post By Category
- Categories manage
- Adding Custom Post Types to category/tag/author archives breaks header content
- Change custom post type permalink according to category
- Change Custom Post Type to Post + Category
- Front End users account with lots of user Roles (not Woocommerce)
- Excluding category from loop not working
- Custom Post – additional param in the custom post URL goes to error page
- Update Cateogory Taxonomy Count for Attachment Post Type
- Getting list of Categories for Custom Post Types
- can’t see categories in appearance-menu-categories
- Extensive search filtering and results->PDF in the front-end
- Custom Post Type + Category archive
- Exclude categories For Custom post types
- Show custom post type in archive page by category
- I have a custom post type that I want to query a dynamic category name from a custom meta field
- Display all post types together
- Trying to create hierarchy between 3-4 custom post types
- Having some trouble properly displaying Custom Post Types in templates
- Displaying wp post categories into my custom metabox
- WordPress custom post type post and category links 404
- show only one category posts in admin
- One set of categories for multiple custom posts
- Choose custom post type template by category
- Are custom posts included when getting a categories’ posts?