Last active
March 25, 2019 06:38
-
-
Save mikeschinkel/d0ade8a26fe4934bb0be to your computer and use it in GitHub Desktop.
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