Home › Forums › General Issues › post title updater not working for pages › Reply To: post title updater not working for pages
Hi, Im using the above, and it works for me,
What I added, in order to make the post slug work is this:
While it works, I am not sure whether it is the best approach, seems to make the saving of a post very slow.
add_action('save_post', 'set_slug');
function set_slug($post_id){
$new_slug = get_post_meta($post_id,'custom-slug', true);
$post_args = array(
'ID' => $post_id,
'post_name' => $new_slug,
);
wp_update_post($post_args);
}
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.