Created
December 2, 2016 14:58
-
-
Save BTMPL/9edfd8669ac4a6f84e7035936a06c09b to your computer and use it in GitHub Desktop.
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 | |
function preventUnnamedPosts($postId) { | |
$post = get_post($postId); | |
if(empty($post->post_title)) { | |
wp_update_post(array( | |
'ID' => $postId, | |
'post_title' => $postId | |
)); | |
} | |
} | |
add_action( 'save_post', 'preventUnnamedPosts'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment