Skip to content

Instantly share code, notes, and snippets.

View LukaHarambasic's full-sized avatar

Luka Harambasic LukaHarambasic

View GitHub Profile
@rveitch
rveitch / sync_acf_post_title.php
Last active July 24, 2024 18:07
Update WordPress post title from an ACF field value on save. (Advanced Custom Fields)
<?php
/**
* Update Post Title from an ACF field value on post save.
*
* Triggers on save, edit or update of published posts.
* Works in "Quick Edit", but not bulk edit.
*/
function sync_acf_post_title($post_id, $post, $update) {
$acf_title = get_field('my_acf_field_name', $post_id); // NOTE: enter the name of the ACF field here