function force_type_private($post)
{
if ($post['post_type'] == 'my_post_type')
$post['post_status'] = 'private';
return $post;
}
add_filter('wp_insert_post_data', 'force_type_private');
please try above code, I hope this will work for you.
Related Posts:
- Is it possible to remove WYSIWYG for a certain Custom Post Type?
- What is the use of the wp_links table?
- How to remove slug from hierarchical custom types in 3.5.2
- Change the edit page for a custom post type?
- Automatically create child pages when saving a (parent) page
- Featured Image Panel Missing From Custom Post Type in WordPress 3.2
- Is there a way to use regular categories with custom post types?
- Best way to style first post differently?
- How to create user personal pages with information from their meta profile fields?
- Including two taxonomies in a permalink structure
- WP Rewrite Rules – Custom post type & taxonomy
- 960gs different classes on teasers posts
- How to Sort by Date When Using d-m-Y Format
- where can I see my custom post type archive template?
- Custom Taxonomies: Multiple Hierarchical Permailnks For A Single Post + Prev/Next Links
- Post Ancestor and Child Post in Custom Post Type
- Need idea: custom post type and custom meta
- Sort posts based on multiple custom fields
- Custom Post Order for a Custom Post Type
- How to make a custom taxonomy selectable in post publish area?
- How to Separate CPT From Regular Posts?
- Specify a Page as the parent to the CPT Archive
- Remove wrong dashes from get_the_title()
- Redirect page to first post in custom post type
- Hooking in to an archive page?
- Edit / delete custom post types through web page (not admin)
- post_row_actions not working for hierarchical post type
- Troubles with saving metabox
- Custom Post Type / Two level deep taxonomy (cat. and subcat.) uri problem (error 404)
- Tax query not producing any results
- How to make global post work with custom post type?
- How should I structure my post types?
- Post Quote with image on header for news site
- Add custom post type as submenu [closed]
- Team club with CPTs and user registration + user dashboard
- CPT post count is 0 for the authors in the User list
- Can’t remove front from permalinks for custom taxonomy category page
- Store CPT ‘Reviews’ average ratings to a WordPress DB table or to a DB custom table?
- Display Child Pages of Custom Post Type Parent Page
- Why isn’t my custom post type archive URL translating?
- How to make custom taxonomy into drop down select in a custom metabox
- Custom post type RSS feed, multiple post published on same day bug
- Custom Post Archive is not working
- Creat new admin url for custom post type
- disable quickedit for specific custom post type user role
- Wp Query with multiple custom tag(taxonomy) by get the terms
- Pagination doesnt work in custom post type
- Custom REST endpoint not working to retrieve single posts (“rest_no_route”)
- how to create custom post type with dynamic category_name using shortcode
- Why is wp api returning old acf values?
- Pagination on search results page
- Custom Post Types and Removing Slugs – should we do it?
- How to display class name in this shortcode post query
- Need to have an archive widget which organizes and displays a custom post type using a custom date field
- Taxonomy rewrite pagination 404
- Display Posts Query with IF function
- Retrieve Custom Taxonomies with Description and Slug
- How to list posts by term (custom taxonomy)
- How to setup different permlalinks for posts and pages?
- WordPress admin for a custom post, hide/collapse the main “title” and “description” boxes
- Custom Post Type Child Won’t Come Through With Pretty Permalinks
- Change ordering of fields of custom post type in admin page
- Use custom post type taxonomy between cpt slug and name
- Adding accordion-section to custom post type edit screen
- Orderby custom fields is not working
- Random item on Custom Query working Local but not on live
- Custom Page out of Wp Theme
- Filtering posts based on three taxonomies
- meta_query Where the key value is stored as an array
- wp_editor in custom post type is not saving formatted text like bold, italic etc
- Building Link List for Custom Tax
- Published page but it is page not found
- One of my headings is mysteriously coming up as a link in my CPT Archive
- Looping through image object using ACF and CPT UI [SOLVED]
- Best way to have one product in both rental and sale parent category
- How do I display specific custom posts, and how do I edit a post’s singular page?
- Unexpected behavior from custom taxonomies
- Custom Fields as Post Type Options
- Listing Custom Post Post from certain category
- How to get past and upcoming post by defining date in custom field?
- How can I include custom post types on a tag page?
- How can I convert custom posts types into regular posts?
- List a custom taxonomy’s terms, with links, on the taxonomy page
- How to get child taxonomies
- WP Query WordPress Post Type with the same Taxonomy name
- Pagination URL order
- Canonicalization + Custom Post Types not working as expected
- Custom Portfolio String
- Loading one meta box only on post-new.php with a forward link
- Top 30 Songs using Custom Post Type
- Adding a custom “Add Custom Field” button to Custom Meta boxes
- show 10 most recent custom post types excluding the one(s) from specific custom taxonomy
- add a “list” into add meta box : problem
- WordPress Admin Page Slow. Customer Post Type is the slowest
- Wp-theme Development
- Posts structure named to blog, how to add month and year
- How to change post cpt with submit button?
- Filtering custom post types using category taxonomy
- set_post_thumbnail or media_sideload_image adds image multiple times in media library
- How to use wp_set_object_terms depending on page ID?