I’ve found a solution, which I’m not liking much, but it works
Essentially what I do is create two hooks to save_post (in this case this is the action that launches this script) with different priorities for example 10 and 20
In the priority 10 I put the wp_insert_post
And in the priority 20 I put the wp_update_post
It works, but is doesn’t seem to be the best solution…
Related Posts:
- Combining queries with different arguments per post type
- Create a shortcode to display custom post types with a specific taxonomy
- custom slug for custom post type
- importing third party json feed as custom post type [closed]
- List the categories under custom taxonomy
- register_post_type & ‘register_meta_box_cb’ argument
- Returning search results by relevance, including Custom Post Types
- Custom Post Type Archives with 0 Posts Redirects as 404
- How to replicate some of Drupal Views functionality in WordPress?
- Archive page with multiple taxonomies rewrite
- It is possible to get a list of post types asociated to a taxonomy?
- Sorting for each custom taxonomy
- WP Rest API Querying Custom Posts by ACF fields
- display multiple term post from taxonomy in a single page
- Dynamic variable for custom taxonomy in loop?
- Display posts of child category in template
- Custom Post Type rewrite redirects to homepage
- Displaying a specific post in a wp query by post id
- What hook should be used to programmatically create a post only when master post is updated?
- How to show post title outside of loop? [closed]
- Prevent author role from editing all posts in custom post type?
- Want to turn WordPress into a paid subscription directory
- Using WPAlchemy metabox values in another metabox
- adding .current* tags to custom post types and taxonomies
- How to get custom post type menu_name?
- Saving repeated option values in a custom query
- Remove custom post type slug not working for child pages
- Rewrite rules for custom post type slug
- Check if admin is editing page or custom post type
- Set up a Child/Parent relationship with a Custom Post Type
- How to output wordpress custom tags separated by comma?
- Admin notice not displaying
- wp_set_object_terms() not adding new term to custom post and custom taxonomy
- convert custom query to wp_query
- How to allow a custom user role to create, edit, delete a specific custom post type only?
- How to hook custom taxonomies to custom post types and make the permalinks work?
- How to get custom post types to play nice with schema.org (aka how to wrap the contents in the schema.org markup)?
- Custom admin post.php page
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- Displaying CPT and custom taxonomy side by side in Bootstrap 4 component
- Nested Custom Post Type or Custom Post Type Parents?
- Repeatable Fields Metabox with Textarea (or wp_editor)
- Hide a widget inside a div on specific type of post
- How to use TinyMCE Editor for one of my custom post meta field?
- How to organise this data within WordPress
- Can anyone help me with galleries and post types?
- Custom post type pagination – always return first page
- Display related custom taxonomy posts in sidebar
- filter search custom field query
- $post not working working in AJAX plugin with custom post type
- Using wp_query to modify the loop in index.php for a CPT
- Problem with $post_id object’s property
- How To Display A List Of CPT Posts In A Meta Box On Menus Page?
- WordPress Custom Post Type and Shortcode for Portfolio Items
- Custom Post type date archive for custom taxonomy
- get custom post type value in header.php [closed]
- Custom Post Type setup
- Missing Post from Custom Post Type
- WordPress custom permalink and archive link for custom post type
- Post ordering not working with custom field
- Add unique ID number to end of permalink
- Changing WordPress sort order for returned child pages
- How to display tag attribute “target” in the_author_meta( ‘description’ );
- Problem with date comparison for custom fields
- Add pagination to custom single post template
- Sortable column with custom data by date
- Set the main page for custom post type
- Fetch data of 2 relational Custom Post in WordPress
- How to keep WP from creating a “single-post” page and let the user input the link of the post in the dashboard?
- Using OR relation in meta_query to check for a value before sorting by another
- Limit to one post for each custom post type
- Change dynamically the dropdown list value
- Default excerpt for parent of a custom post type
- CPT relations use in permalinks under single post type
- Taxonomies are not showing in the category dropdown
- Add Pagination in custom Blog page template
- get_the_terms child terms for current post/custom post only
- Unknown Post Meta Records
- Show Recently Viewed Custom Post to the visitor without plugin
- Custom Post Type Query by user id
- CPT post doesnt shows tags and category on backend admin page
- Adding a nav menu for a custom post type
- WordPress API only returning HTML
- select custom post type on regular post
- woocommerce post_type conflict with existing post type
- Custom taxonomy- only output relevant terms
- Post types showing tables…Can I do that?
- Registering an optional custom post type from a plugin
- Dropdown switching subcategories portfolio
- Weird capabilities / roles behavior
- How to Arrange Support => Thumbnail
- Filter custom post type by tags
- Displaying posts exclusively in their category (not parent)
- Can’t make permalink of CPT work
- Issue with permalinks for custom post type
- Setting a Master Menu on a Custom Post Type
- Linking from a list of custom post type items to a single – get_post_permalink not working correctly
- Remove plugin’s custom post type archive page and single pages [closed]
- After wp_insert_post() custom post type does not show in the admin
- How to add custom permalink struct with DYNAMIC author to a Custom Post Type