• Code says this

    // Forget the previous value when going to a specific editor.
    $edit_url = add_query_arg( 'classic-editor__forget', '', $edit_url );

    // Build the edit actions. See also: WP_Posts_List_Table::handle_row_actions().
    $title = _draft_or_post_title( $post->ID );

    // Link to the block editor.
    $url = remove_query_arg( 'classic-editor', $edit_url );
    $text = _x( 'Edit (block editor)', 'Editor Name', 'classic-editor' );
    /* translators: %s: post title */
    $label = sprintf( __( 'Edit “%s” in the block editor', 'classic-editor' ), $title );
    $edit_block = sprintf( '<a href="%s" aria-label="%s">%s</a>', esc_url( $url ), esc_attr( $label ), $text );

    // Link to the classic editor.
    $url = add_query_arg( 'classic-editor', '', $edit_url );
    $text = _x( 'Edit (classic editor)', 'Editor Name', 'classic-editor' );
    /* translators: %s: post title */
    $label = sprintf( __( 'Edit “%s” in the classic editor', 'classic-editor' ), $title );
    $edit_classic = sprintf( '<a href="%s" aria-label="%s">%s</a>', esc_url( $url ), esc_attr( $label ), $text );

    this results in a “Classic edit” link with both classic-editor and classic-editor__forget resulting in a not-classic editor, at least in our current situation with WP Bakery installed. (yes, yes, I know, it’s a legacy, ported, imported and finally once again ported website. 15 years old. Don’t judge)

    My question is; is it intentional that both classic-editor and classic-editor__forget are on the link? of so, then I will go complain with WP Bakery, if not, the solution is simple;

    // Start with a clean slate.
    $edit_url = remove_query_arg( [ 'classic-editor', 'classic-editor__forget' ], $edit_url );

    // Build the edit actions. See also: WP_Posts_List_Table::handle_row_actions().
    $title = _draft_or_post_title( $post->ID );

    // Link to the block editor, forget classic.
    $url = add_query_arg( 'classic-editor__forget', '', $edit_url );
    $text = _x( 'Edit (block editor)', 'Editor Name', 'classic-editor' );
    /* translators: %s: post title */
    $label = sprintf( __( 'Edit “%s” in the block editor', 'classic-editor' ), $title );
    $edit_block = sprintf( '<a href="%s" aria-label="%s">%s</a>', esc_url( $url ), esc_attr( $label ), $text );

    // Link to the classic editor.
    $url = add_query_arg( 'classic-editor', '', $edit_url );
    $text = _x( 'Edit (classic editor)', 'Editor Name', 'classic-editor' );
    /* translators: %s: post title */
    $label = sprintf( __( 'Edit “%s” in the classic editor', 'classic-editor' ), $title );
    $edit_classic = sprintf( '<a href="%s" aria-label="%s">%s</a>', esc_url( $url ), esc_attr( $label ), $text );

    Thank you in advance for your response

The topic ‘Classic Editor mode broken?’ is closed to new replies.