• Resolved eddivalen

    (@eddivalen)


    Hey @Abhishek,

    I’m trying to find out if there’s a hook or action that triggers after new data is inserted or updated in a custom table. I’ve tried using wp_after_insert_post and transition_post_status, but they don’t seem to work as expected.

    When using wp_after_insert_post, the update doesn’t reflect the latest changes.

    And with transition_post_status, I find issues when data is inserted for the first time; the hook triggers before the data is created in the custom table.

    Do you have any suggestions? Appreciate your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Abhishek

    (@abhisheksatre)

    Hi,

    You can use acf/save_post action with high priority.

    Example:

    add_action('acf/save_post', 'handleAcfSave', 20); // Priority 20
    
    function handleAcfSave( $post_id ) {
      // ACF data is saved to custom table. 
    }

    Using the transition_post_status action with a high priority will also work.

    FYI, our plugin offers the acf_ct/update_table_data filter, allowing you to modify custom table data before it’s inserted into the custom table.

    Thread Starter eddivalen

    (@eddivalen)

    Thank you @abhisheksatre!

    That’s exactly what I was looking for. Appreciate it!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Hook or action after data insertion in custom table?’ is closed to new replies.