ID ) ) { return; } // Skip for menu items. if ( get_post_type( $post->ID ) === 'nav_menu_item' ) { return; } $this->insert( [ 'object' => 'post', 'object_id' => $post->ID, 'action' => $action, 'object_name' => $this->_draft_or_post_title( $post->ID ), ] ); } /** * When a post is deleted. * * @param integer $post_id * @return void */ public function delete_post( $post_id ) { if ( wp_is_post_revision( $post_id ) ) { return; } $post = get_post( $post_id ); if ( in_array( $post->post_status, [ 'auto-draft', 'inherit' ] ) ) { return; } // Skip for menu items. if ( get_post_type( $post->ID ) === 'nav_menu_item' ) { return; } $this->insert( [ 'object' => 'post', 'object_id' => $post->ID, 'action' => 'deleted', 'object_name' => $this->_draft_or_post_title( $post->ID ), ] ); } }