Home Forums Backend Issues (wp-admin) Gutenberg blocks – ACF does not save if key has "-" in value


Gutenberg blocks – ACF does not save if key has "-" in value

  • I just made a very, in name, unique field to be sure problem is real.

    All fields with one word in key (no -) save values without problems. But those with multiple words not. No matter if I reduced field Name to one word.

    For instance this field (never used before, just to be sure) is not saving:


    ACF PRO is updated to latest, WP latest.

  • Can you please just correct topic title, thanks.

  • Tipically. Snippet to prevent duplicate slugs makes it.

    function bhrs_save_post_callback( $post_ID, $post, $update ) {
        if (in_array($postarr['post_type'], array('post', 'page', 'chronik', 'mitglied', 'galerie', 'vorstand', 'event')) &&
    !in_array($data['post_status'], array('publish', 'draft', 'pending', 'auto-draft', 'future', 'private', 'trash')))
        // unhook this function to prevent infinite looping
        remove_action( 'save_post', 'bhrs_save_post_callback', 10, 3 );
        // update the post slug (WP handles unique post slug)
        wp_update_post( array(
            'ID' => $post_ID,
            'post_name' => ''
        // re-hook this function
        add_action( 'save_post', 'bhrs_save_post_callback', 10, 3 );
    add_action( 'save_post', 'bhrs_save_post_callback', 10, 3 );

    This one leave ACF slugs alone:

    // Force slug auto generate
    function myplugin_update_slug( $data, $postarr ) {
    if (in_array($postarr['post_type'], array('post', 'page', 'chronik', 'mitglied', 'galerie', 'vorstand', 'event')) &&
    !in_array($data['post_status'], array('publish', 'draft', 'pending', 'auto-draft', 'future', 'private', 'trash'))) {
    $data['post_name'] = sanitize_title( $data['post_title'] );
    return $data;
    add_filter( 'wp_insert_post_data', 'myplugin_update_slug', 9, 2 );
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.