Skip to content

Instantly share code, notes, and snippets.

@mikeschinkel
Last active March 25, 2019 06:38
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mikeschinkel/d0ade8a26fe4934bb0be to your computer and use it in GitHub Desktop.
AcmeSavePost - For a comment on Tom McFarlin's blog
<?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