wp_save_post_revision_check_for_changes

過濾鉤子
apply_filters( 'wp_save_post_revision_check_for_changes', true, $latest_revision, $post )

wp_save_post_revision_check_for_changes:這是一個 WordPress 鉤子,在儲存文章修訂版本之前被觸發。該鉤子允許您檢查是否已經對文章做了任何更改,如果沒有,則可以阻止修訂版本的建立。

預設情況下,只有當修訂的欄位之一發生變化時才會儲存修訂。

這個過濾器可以覆蓋這一點,所以即使沒有任何變化,也會儲存一個修訂。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
if ( isset( $latest_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $latest_revision, $post ) ) {
if ( isset( $latest_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $latest_revision, $post ) ) {
if ( isset( $latest_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', true, $latest_revision, $post ) ) {

常見問題

FAQs
檢視更多 >