AcmeSavePost - For a comment on Tom McFarlin's blog
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AcmeSavePost { | |
public function __construct() { | |
add_action( 'save_post', array( $this, 'modify_post_content' ) ); | |
} | |
public function modify_post_content( $post_id ) { | |
static $recursing = false; | |
if ( ! $recursing ) { | |
$recursing = true; | |
$post = array( | |
'ID' => $post_id, | |
'content' => '' | |
); | |
wp_update_post( $post ); | |
$recursing = false; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment