Last active
September 24, 2020 18:59
-
-
Save marktenney/8e412b6629ec41910859f8cd758b45db to your computer and use it in GitHub Desktop.
generate-post-title-from-custom-fields.php
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 update_post( $post_id ) { | |
$firstname = rwmb_meta('person_firstname'); | |
$lastname = rwmb_meta('person_lastname'); | |
$post = array( | |
'ID' => $post_id, | |
'post_title' => $firstname . ' ' . $lastname, | |
'post_name' => $post_id, | |
); | |
wp_update_post( $post ); | |
} | |
add_action('save_post_people', 'update_post', 20); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment