post_updated

最后更新于:2021-11-27 17:59:21

do_action( ‘post_updated’, int $post_ID, GC_Post $post_after, GC_Post $post_before )

Fires once an existing post has been updated.

参数

$post_ID

(int)
Post ID.

$post_after

(GC_Post)
Post object following the update.

$post_before

(GC_Post)
Post object before the update.

源文件

文件: gc-includes/post.php

View on Trac

<?php
function check_values($post_ID, $post_after, $post_before){
    echo '<b>Post ID:</b><br />';
    var_dump($post_ID);

    echo '<b>Post Object AFTER update:</b><br />';
    var_dump($post_after);

    echo '<b>Post Object BEFORE update:</b><br />';
    var_dump($post_before);
}

add_action( 'post_updated', 'check_values', 10, 3 ); //don't forget the last argument to allow all three arguments of the function
?>