Created
April 8, 2015 17:14
-
-
Save nciske/f3c5c20da49ad19269c1 to your computer and use it in GitHub Desktop.
Save post content to disk
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
function pht_write_file( $id, $post) { | |
$upload_dir = wp_upload_dir(); | |
$file = $upload_dir['basedir']."/publication-hub-tools/test.xml"; | |
$content = $post->post_content; | |
// convert $content to XML... | |
file_put_contents( $file, $content ); | |
} | |
add_action( 'publish_post', 'pht_write_file', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment