• Resolved GarrettB

    (@garrettb)


    Hi
    Is it possible, in the Block Editor, to add one its buttons and make it have the same functionality as the browser’s back button?
    I know this is not always recommended, but it will suit the style of p[ages I am creating, where I am offering a few navigation options, with nice big buttons, for older users.
    Usually if I add a button, I would paste in a link to another page etc., or even an anchor on the current page, but in this case I want to just go back.

    • This topic was modified 2 years, 4 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Everything else WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • Is it possible, in the Block Editor, to add one its buttons and make it have the same functionality as the browser’s back button?

    This will require JavaScript.

    Where you’d normally input the destination URL for the button, put the following code:

    javascript:window.history.back();

    Note that the user publishing the page/post must have the unfiltered_html capability (ie be an Administrator or Editor)… else the JavaScript code will be stripped out by WordPress.

    Good luck!

    Thread Starter GarrettB

    (@garrettb)

    George, that worked!
    Thank you so much ??

    Regards
    Garrett

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding a Back Button using Block Editor button’ is closed to new replies.