Home › Forums › ACF PRO › oddities with field key in repeater › Reply To: oddities with field key in repeater
So my problem was a function I had setup. It was supposed to update the posts slug on save and it seems it was updating the field_key as a title slug as well.
This is the code, if you have any suggestions how to make it only update posts and page slugs I’d love to hear it.
// Updates slug from post title on Save
function myplugin_update_slug( $data, $postarr ) {
if ( !in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) {
$data['post_name'] = sanitize_title( $data['post_title'] );
}
return $data;
}
add_filter( 'wp_insert_post_data', 'myplugin_update_slug', 99, 2 );
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.