Skip to content

Instantly share code, notes, and snippets.

View mediaryte's full-sized avatar

Mediaryte mediaryte

View GitHub Profile
@philhoyt
philhoyt / advanced-custom-fields-post-title.php
Last active August 18, 2024 12:00
Using Advanced Custom Fields to create your Post Title
<?php
/** Create Title and Slug */
function acf_title( $value, $post_id, $field ) {
if ( get_post_type( $post_id ) === 'staff' ) {
$new_title = get_field( 'first_name', $post_id ) . ' ' . $value;
$new_slug = sanitize_title( $new_title );
wp_update_post(
array(