1. Home
  2. Knowledge Base
  3. code
  4. html
  5. Create HTML back button and link
  1. Home
  2. Knowledge Base
  3. WordPress
  4. Create HTML back button and link

Create HTML back button and link

The jump to the previous page can be implemented as a text link, for example. To do this, the following code must be inserted into the HTML:

<a href="javascript:history.back()">Back</a>

HTML back button displayed as a button

If the back button should actually be displayed as a button, you can enable this with the following HTML code:

<input type="button" value="Back" onClick="javascript:history.back()">

Installing the back button in WordPress

You can of course also integrate the above button or code snippet into WordPress. However, it is important to know that you must not insert the code snippet in the text editor in “visual” mode, but must first switch the editor to “text” mode (top right). You can only insert HTML code in text mode.

Alternatively, you can also integrate the button via shortcode.

HTML back button as shortcode for WordPress

Insert the following code snippet into your functions.php file of your (child) theme:

function add_back_button_shortcode() {
return '<a href="javascript:history.back();">Zurück</a>';
}
add_shortcode( 'back_button', 'add_back_button_shortcode' );

Then you can use the shortcode [back_button] to insert the back button into your WordPress page.


Dieser Beitrag ist auch verfügbar auf: Deutsch (German)

Was this article helpful?

Related Articles

Submit a Comment

Your email address will not be published. Required fields are marked *

Published on - 18. Sep 2021
Modified on - 29. Mar 2024
Views - 104
Likes - 0

Do you need help?

Kontaktiere uns gerne :-)
Contact Support
Skip to content