Using JS is one way we can achieve that,

Firstly add below code into your theme function.php

function add_scripts_editor(){
    wp_enqueue_script('mytheme', get_stylesheet_directory_uri() . '/js/mytheme.js', array('jquery'), '', true );
}
add_action('admin_enqueue_scripts', 'add_scripts_editor');

Then create mytheme.js into your js folder and add the below code into it. Now open any POST/PAGE type and your Back Button is added, you can add any link to it to navigation to your user he want to go back.

function addBackButton() {
            if ($('.editor-header__settings').length > 0 && $('#gutenberg-back-button').length === 0) {
                // Create and append the Back Button to the header
                var backButton = $('<button id="gutenberg-back-button" class="components-button is-primary">Back to Dashboard</button>');
                $('.editor-header__settings').prepend(backButton);

                // Add click event handler to the button
                $('#gutenberg-back-button').on('click', function () {
                    window.location.href = '/user-profile';
                });
            }
        }

        // Initial call to add the button
        addBackButton();

        // Check periodically if the editor is loaded and add the button
        var interval = setInterval(function () {
            if ($('.editor-header__settings').length > 0) {
                addBackButton();
                clearInterval(interval);
            }
        }, 500);
Tags