Deprecated: Elementor\DB::is_built_with_elementor is deprecated since version 3.2.0! Use Plugin::$instance->documents->get( $post_id )->is_built_with_elementor() instead. in /home/shabti/frontendadmin.com/wp-includes/functions.php on line 5325
frontend_admin/save_post - Frontend Admin

frontend_admin/save_post

Table of Contents

Description

This action hook fires when a post is saved.

This action allows you to hook in after the form saves data to a new or existing post, making it useful to perform additional functionality when adding or updating your posts.

Important: this hook will only be fired when saving a post. If you are saving user data, please use frontend_admin/save_user.

Parameters

do_action( 'frontend_admin/save_post', $form, $post_id );
  • $form (array) The form settings, including $form[‘record’][‘post’] which contains all of the submitted post fields’ data.
  • $post_id (int|string) The ID of the post being edited.

Examples

Send email after post is saved.

This example demonstrates how to send an email after the post has been saved. Place this in your functions.php or a dedicated code snippets plugin.

functions.php

add_action('frontend_admin/save_post', 'my_fa_save_post', 10, 2);
function my_acff_save_post( $form, $post_id ) {
    
    //get important fields
    $post_content = get_post_field('post_content',$post_id);
    $post_title = get_post_field('post_title',$post_id);
    $email_address = get_field('email_address', $post_id);
    
    if( $email_address ) {
        $email_sent = wp_mail( $email_address, $post_title, $post_content );
    }

Table of Contents

Get the free plugin and receive updates