By searching a lot to API documentation, I found the solution to my problem finally:
function my_rest_prepare_post( $prepared_post, $request ) {
...
}
add_filter( 'rest_pre_insert_posttype', 'my_rest_prepare_post', 10, 3 );
Related Posts:
- How to Debug the ‘save_post’ Action?
- How to: Display ACF [fields] on Custom Post Types Utilising WordPress ‘Hooks’? [closed]
- ACF for custom post type archive pages: which hook to use?
- Filter Content on all Post Types
- Filter by custom field in custom post type on admin page
- Calling a Function After New Post Creation for a WordPress Custom Post Type?
- Adding a drag and drop re-ordering from a custom post type default list [closed]
- get_query_var() not working in pre_get_posts
- Filtering a WP_Query meta_query by numeric values isn’t working
- Populate a ACF Select Dropdown from Custom Post Type
- Filter a custom field based on selection of another custom field (ACF) [closed]
- How to create notification on frontend using heartbeat api for multiple custom post types
- WordPress Search documentation: how to improve search query using taxonomy terms, custom meta fields?
- Retrieve a specific field from taxonomy term through advanced custom fields [closed]
- Count custom post types with a specific meta value
- How to register custom post types in a plugin?
- Display posts if a custom field value is equal to another custom field value
- ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
- ACF simple text field value not showing
- Post Object Filter by Custom Field, not title (ACF)
- Rewrite WordPress URL to show CPT meta field data
- Hooking in to an archive page?
- Multiple ACF Repeaters within a Custom Post Type
- How to change post featured image using a custom field of category?
- Custom fields vs. Custom post types for a Portfolio Website
- How to add a post slug to a url?
- Add custom ID to CPT posts only create not update
- ACF Field on CPT Slug
- WP_Query order by custom field, then randomly order some of results
- Custom Post Type + ACF and performance [closed]
- How to render a custom post type template with custom fields using shortcode
- Limit number of custom posts per taxonomy
- How to query WordPress posts bycustom field with a max characters’ length
- The loop seems stuck to a single (now deleted) post
- Displaying custom field according to date
- Advanced custom field boolean value in custom post type
- Get rid of “trash can” for custom post type
- Why would social icon badges disappear after adding a custom post type?
- ACF repeater field usage
- Custom Meta fields Update hook?
- wp_trash_post action hook with custom post type
- Postname on unique permalink structure appends “-2” for a custom post type. How can I get this to stop happening?
- Custome fields not displayed
- providing access to post_id or post inside functions.php
- Batch Extract Date from post title and put into ACF custom field
- Why is wp api returning old acf values?
- get custom post type value in header.php [closed]
- How do I get_the_postID() for a custom post that uses ACF repeater field?
- Custom post types, disable fields
- ACF Relationship Posts how to show additional content
- comments hooks on custom post type
- Catch and display error on save_post action
- Excerpt length: get first paragraph
- How to recover the post ID earlier in the WP admin hook action “firing” sequence?
- How can i show ACF in post excerpts
- Using `set_transient()` when saving a custom post type
- count & sum the value of custom field of the author post in dynamic posts
- Grouping custom wordpress post types by acf value
- Set Post Private if no linked Post Objects (ACF)
- Show in an entry a Custom Post Type associated to a post
- Title and URL Error in Breadcrumb Navigation for Custom Post Types
- Orderby custom fields is not working
- Add html tot CPT edit screen – no metabox
- Display a Custom Post Type with Advanced Custom Fields on Homepage
- Filter result of Custom Post Type using meta_query with ACF
- In child theme, add CPT to custom taxonomy registered in parent theme
- How to display posts with plugin (advanced custom fields) field groups?
- WordPress – display relationship between blog posts and custom posts
- Same custom post type with different ACF
- Changing CPT permalink
- Custom sorting in post columns by ACF Pro Select Field
- Load info from customposttype into template page
- Subpages URLs for Custom Post Type
- ACF meta_key and meta_value break loop
- search results to show individual ACF fields from inside custom posts
- Videos Post Type with Custom Filters
- How to show link to product in custom fields?
- Sort custom post archives by a meta value from a different custom post type?
- Correct way to register custom post type from external php file?
- In the admin, how can you list thumbnails instead of titles for a custom post type?
- Use output of wp_dropdown_categories($args)
- Looping through image object using ACF and CPT UI [SOLVED]
- Values show up in custom home page but not in custom post pages
- Display related post content and custom field content
- WordPress page not showing up – replaced with last 10 posts?
- 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?
- Showing custom post user wise with different color in wordpress
- How to load custom post type plugin after acf options page (or get settings from there another way)?
- Custom Fields as Post Type Options
- Adding Information To All Posts Screen
- Advanced Custom Fields – Add Field to Specific Page [closed]
- Customizing a plugin function using a hook
- $post breaking container loop
- Collection of fields in a single post
- using a template for more then 1 page
- Retrieve a post with its ACF repeater fields in wordpress
- Two custom post type relations
- Change CPT Edit Target Link for Admin List
- selecting custom post types and taxonomies for hub page listing blocks