Skip to content

Commit

Permalink
Removes post document from index when unpublished.
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Christopher committed Mar 17, 2015
1 parent b18068d commit e2c572f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion wp/admin/hooks.php
Expand Up @@ -6,8 +6,15 @@ function __construct(){
add_action( 'save_post', array( &$this, 'save_post' ) );
add_action( 'delete_post', array( &$this, 'delete_post' ) );
add_action( 'trash_post', array( &$this, 'delete_post' ) );
add_action( 'transition_post_status', array( &$this, 'unpublish' ), 10, 3 );
}


function unpublish($new_status, $old_status, $post) {
if ($old_status == 'publish' && $new_status != 'publish') {
$this->delete_post($post);
}
}

function save_post( $post_id ) {
if(is_object( $post_id )){
$post = $post_id;
Expand Down

0 comments on commit e2c572f

Please sign in to comment.