ID ) ) return; // Skip for menu items. if ( 'nav_menu_item' === get_post_type( $post->ID ) ) return; aal_insert_log( array( 'action' => $action, 'object_type' => 'Post', 'object_subtype' => $post->post_type, 'object_id' => $post->ID, 'object_name' => $this->_draft_or_post_title( $post->ID ), ) ); } public function hooks_delete_post( $post_id ) { if ( wp_is_post_revision( $post_id ) ) return; $post = get_post( $post_id ); if ( in_array( $post->post_status, array( 'auto-draft', 'inherit' ) ) ) return; // Skip for menu items. if ( 'nav_menu_item' === get_post_type( $post->ID ) ) return; aal_insert_log( array( 'action' => 'deleted', 'object_type' => 'Post', 'object_subtype' => $post->post_type, 'object_id' => $post->ID, 'object_name' => $this->_draft_or_post_title( $post->ID ), ) ); } public function __construct() { add_action( 'transition_post_status', array( &$this, 'hooks_transition_post_status' ), 10, 3 ); add_action( 'delete_post', array( &$this, 'hooks_delete_post' ) ); parent::__construct(); } }