Created
December 2, 2016 14:56
-
-
Save BTMPL/1b21308ff0ae22fd96cd7794355f8551 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)) { | |
remove_action( 'save_post', 'set_private_categories' ); | |
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