How to Add Back Buttons to Web Pages [closed] (ok)
https://wordpress.stackexchange.com/questions/221640/how-to-add-back-buttons-to-web-pages
if( wp_get_referer() )
echo '<a href="'<?php wp_get_referer() ?> '" >BACK</a>';
Or
Add into theme functions.php
add_action( 'back_button', 'wpse221640_back_button' );
function wpse221640_back_button(){
if ( wp_get_referer() && !is_front_page() ){
$back_text = __( '« Back' );
$button = "\n<button id='my-back-button' class='btn button my-back-button' onclick='javascript:history.back()'></button>";
echo ( $button );
}
}
Add into theme header.php after <body>
<?php do_action('back_button'); ?>
PreviousHow To Add Custom Product Fields in WooCommerce (ok)NextHide products from a Woo category, tag on the Shop Page (ok)
Last updated
Was this helpful?