add_filter('acf/save_post', acf_save_post, 10, 1); function acf_save_post($post_id) { $new_post = get_post($post_id); if (!($new_post instanceof WP_Post)) { return; } if (!have_rows('modules', $post_id)) { return; } ob_start(); global $post; $post = $new_post; setup_postdata($post); get_template_part('includes/modules', null, array('save' => true)); $html = ob_get_contents(); ob_end_clean(); wp_reset_postdata(); $post = get_post($post_id); $post->post_content = $html; wp_update_post($post, [], false); }