Stop Benecaster offering updated tours again
When a guided tour is updated, Benecaster offers it again to everyone who completed an earlier version, with a bar at the top of the next Benecaster screen: “The {tour} tour has been updated since you last took it.” If that bar is unwelcome on your site, switch it off with benecaster_tour_reprompt_enabled: for everyone, for one tour, or for some users.
Only the offer stops. The Tours panel still runs every tour, and completions are still recorded.
The example keeps the offer for administrators and switches it off for everyone else.
Your callback is asked only about tours the user has completed, because those are the only ones that can be offered again. Don’t rely on it running for every tour.
Return a real false. Anything else, including a forgotten return, leaves the offer on.
This is the site owner’s side. The author’s side, raising a tour’s contentVersion so it is offered again, is in Register a guided product tour from an add-on JS bundle.
Code
<?php
// Only administrators are offered updated tours again.
add_filter( 'benecaster_tour_reprompt_enabled', function ( bool $enabled, string $tour_id, int $user_id ): bool {
return user_can( $user_id, 'manage_options' ) ? $enabled : false;
}, 10, 3 );
// Or, to switch it off for everyone and every tour:
// add_filter( 'benecaster_tour_reprompt_enabled', '__return_false' );
Hooks Used
Need this built rather than just documented? See our services →