Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

Custom post type: “transition_post_status” action get title and other fields

I’ve come up with my own solution. I used the publish_post action instead of the transition_post_status action.

$this->loader->add_action( 'publish_cursussen', $plugin_admin, 'save_cursus_meta', 10, 2);

The problem before was the data not being saved yet.. with this new functions i can get the ID and with that ID the title

public function add_new_form( $cursus_title ){
        $form_id = 2; //Standard form
        $form = GFAPI::get_form($form_id);
        $form['title'] = $cursus_title;
        $form['limitEntriesCount'] = 100;
        $result = GFAPI::add_form( $form );
        return $result;
    }

    public function save_cursus_meta( $ID, $post ){
        $post_type = get_post_type($ID);
        $cursus_title = get_the_title($ID);
        // If this isn't a 'book' post, don't update it.
        if ( "cursussen" != $post_type) return;

        $myPost = get_post($ID);
        if( $myPost->post_modified_gmt == $myPost->post_date_gmt ){
            $this->add_new_form($cursus_title);
        }else{
            return;
        }
    }

Hope this can help somebody in the future!

Related Posts:

  1. Query all posts where a meta key does not exist
  2. what is the correct way to compare dates in a WP query_posts meta_query
  3. Storing revisions of metadata for custom post type
  4. Admin Area Custom Type Search By Meta Fields Without Title & Content
  5. How can I filter posts by post_parent in the admin?
  6. Custom Post Type with Input fields to seperate table on database.
  7. How to create a mini directory in WordPress?
  8. How Can I save multiple records in same meta key?
  9. Detect meta value changes when post is updated (post_updated)
  10. Search everything (posts, pages, tags, cpt, meta)
  11. Compare 3 custom fields and sort by oldest
  12. Creating a custom post type upon registration
  13. Can’t sort order of wp_query with 2 meta keys
  14. Showing Meta Data for Custom Post Types?
  15. How to get source of custom meta image?
  16. Having trouble with custom post type / meta box
  17. update a post meta from a single table cell TablePress
  18. Custom Meta Boxes – Nonce Issue – Move to trash issue
  19. Displaying Meta Box Image
  20. How to keep a check box in custom meta box for custom post type checked by default for add new post?
  21. ACF Upload Image in repeater from front-end with custom form? – add_post_meta()
  22. Using date stored as custom field to filter posts displayed in admin
  23. Displaying custom posts only if custom meta box’s date is not expired
  24. Displaying Metabox value (custom post type taxonomy)
  25. Meta Box Only in CPT Edit Page, Not in Add New
  26. get_post_meta is returning image id
  27. Custom Post Type, Saving Multiple Checkboxes
  28. Create a random unique 6 digit number as custom field for custom post type
  29. Export entries and multiple custom field meta to .csv?
  30. Metadata for a taxonomy – is there any WordPress way of doing this?
  31. Update CPT post meta with update_post_meta and cron job
  32. Custom meta box data array: foreach not working correctly?
  33. Insert post metadata for all posts in CPT at once if metadata no existent
  34. Display custom post type from dynamic custom field
  35. Populate dropdown from one custom post type inside another custom post type
  36. How to check if user meta field is empty in conditional else statement
  37. Get posts between custom dates
  38. A better way to add a meta box to custom post types
  39. post meta parameter in post custom-post-type endpoint with restapi
  40. How do I set all of a particular post meta to a value within the custom post type I’m in?
  41. Custom fields (wp_post_meta) vs Custom Table for large amount of data
  42. Storing a many to many post type relationship in post meta and keeping SQL ability for Joins
  43. Custom filter function not working with Custom post type
  44. Getting thumbnails of a custom posts featured images in a page-templates metabox
  45. Custom fields for custom post type
  46. Show future events based on custom field AND order by date
  47. If Post Meta Equals Current Title Conditional Advanced Custom Fields
  48. create custom meta box with default value
  49. How to Echo Metadata Value in Currency Format
  50. Issue on Working with Metabox – Checkbox to enable Sale Items
  51. delete_post_meta() for whole CPT / multiple posts?
  52. How to move a post to different post type with all meta data?
  53. Why do I have to press the “Update” button twice to save my meta box values?
  54. how to show records that don’t have custom meta value
  55. WP API Response does not show my registered metadata
  56. How to detect that the save_post hook is calling the callback associated to the current edit post page only
  57. get_post_meta returns NULL in front-end, but correct result in back-end
  58. Problem with adding custom post type meta to header by plugin
  59. Meta box data is saved but NOT displayed in the meta box text field. Why?
  60. How to call a post’s metadata in shortcode.php?
  61. Echo custom post meta from options array
  62. Value of post meta dropdown is not showing in WordPress
  63. WP_Meta_Query object with conditionals
  64. Trying to write shortcode with get_post_meta but isn’t working
  65. HM CMB: Post Select Field for CPT ID
  66. updating one custom meta field only
  67. Add a class to post_class if more than one post shares same meta_value_num
  68. Function to return values from metabox
  69. Add a meta field to the list of results for a custom post type
  70. Problem Saving Custom Post Type Meta Values
  71. Custom fields for post or terms which don’t update on post update
  72. Should I use a custom taxonomy or custom post type for grouping a list of panels associated with a group of tests?
  73. How to use multiple Meta Field from CPT as Post permalink
  74. Show posts from WP Custom Post Type selected from a field in a metabox
  75. Creating an archive page or simple template to list all values of a custom field of specific post type listing
  76. Peepso: Add extra data field (custom post meta) to postbox
  77. Change picture attachment meta of all occurrences of a picture
  78. Unknown Post Meta Records
  79. Get Previous Post based on Custom Field Name, for Custom Post Type
  80. Saving custom post types post_meta over REST-API fails
  81. add action save post type and update post meta woocommerce
  82. get_post_meta not working with variable as a post_id for dynamically get the postid
  83. How to get post detail based on URL of the post
  84. Linking posts together with Advanced Custom Fields “both ways”
  85. custom search results – order results differently by post type
  86. Stripe multiple transactions
  87. How to get Current week and current date record wp query
  88. get_post_meta for Custom Post Type ( CPT )
  89. Edit is changing my custom’s post type parent id
  90. Complex strcuture as CPT or taxonomy for use in woocommerce product variations [closed]
  91. How to add post reference field to a plugin?
  92. WordPress custom post type
  93. Edit post meta direct from post.php?
  94. Custom Post Type meta oembed html output resulting in WSoD
  95. Timetable of Custom Meta Data using Custom Post Type and Custom Taxonomy
  96. Change the contents of a dropdown through the admin panel?
  97. fetch meta fields inside a widget
  98. Custom post type – update_meta not working
  99. Custom Form Data save after Login User
  100. Use a Variable in update_post_meta as the $meta_key
Categories custom-post-types Tags custom-post-types, post-meta
Hide post category name wherever it might be mentioned
How to Position Read More link after post excerpt?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress