Home Forums ACF PRO Comparing two select fields Reply To: Comparing two select fields

  • Figured it out. The publish-hook is to early for ACF, so none of the newly published fields are ready yet. I changed it up to this:

    add_action( 'save_post', 'save_jobb', 100, 3 );

    ..also cranking up the priority to 100, to make sure that all other save jobs are done first.

    Furthermore I added a check for post type early in the new function, since the new one takes on all posting in general:

    $post_type = get_post_type($post_id);
    if ( "jobb" != $post_type ) return;

    Lastly, to prevent emails from being sent every time I edit a post belonging to a customer, I also added a small, new ACF field named mailsendt – to just hold the value 0 or 1 depending on whether a mail already has been sent or not.