Skip to content

Instantly share code, notes, and snippets.

@Critter
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Critter/a8f8ba78a1165420e8a5 to your computer and use it in GitHub Desktop.
Save Critter/a8f8ba78a1165420e8a5 to your computer and use it in GitHub Desktop.
prevent posting to Wordpress
add_filter( 'wp_insert_post_data', 'post_publish_filter_wpse_82356' );
function post_publish_filter_wpse_82356( $data ) {
// view/manipulate $data
// we still need to be able to post pages and products so just kill off attempted posts
if ('publish' == $data['post_status'] && 'post' == $data['post_type']) {
$msg = '<pre>' . var_export($data, true) . '</pre>';
wp_die($msg);
}
return $data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment