: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
* Handles pointers throughout Popup Maker.
window.pumPointers = window.pumPointers || {
function open_pointer( id ) {
var pointer = pumPointers.pointers[id];
// Checks if we need to do anything prior to opening pointer.
if ( pointer.hasOwnProperty( 'pre' ) ) {
// Checks if we need to do any clicks.
if ( pointer.pre.hasOwnProperty( 'clicks' ) ) {
$.each( pointer.pre.clicks, function( index, element ) {
// If target is not valid, exit early.
var $target = $( pointer.target );
if ( 0 === $target.length ) {
// Prepare the options to be passed to wp-pointer.
var options = $.extend( pointer.options, {
pointer: pointer.pointer_id,
action: 'dismiss-wp-pointer',
// If we have other pointers left in tour, open the next.
if ( false === skipTour && id !== pumPointers.pointers.length - 1 ) {
buttons: function( event, t ) {
var $btn_skip = $( '<button class="button" style="margin-right: 10px;">Skip tour</button>' );
var $btn_next = $( '<button class="button button-primary">Next</button>' );
var $btn_complete = $( '<button class="button button-primary">Thanks!</button>' );
var $wrapper = $( '<div class=\"pum-pointer-buttons\" />' );
$btn_skip.bind( 'click.point', function( e ) {
t.element.pointer( 'close' );
for ( var i = 0; i < pumPointers.pointers.length; i++ ) {
* If the user has never dismissed pointers before, there is a chance
* their user meta key hasn't been set yet. If we fire too many of these
* at once, WordPress will rewrite itself a few times causing not all
setTimeout( function( i ) {
pointer: pumPointers.pointers[i].pointer_id,
action: 'dismiss-wp-pointer',
$btn_next.bind( 'click.pointer', function( e ) {
t.element.pointer( 'close' );
$btn_complete.bind( 'click.pointer', function( e ) {
t.element.pointer( 'close' );
// If this is the first pointer of a tour...
if ( 1 !== pumPointers.pointers.length && 0 === id ) {
// ... then show a skip tour button.
$wrapper.append( $btn_skip );
// If this is the last pointer in tour...
if ( id === pumPointers.pointers.length - 1 ) {
// ... then show complete button.
$wrapper.append( $btn_complete );
// ... else show next button.
$wrapper.append( $btn_next );
// Show pointer after scrolling to target.
var this_pointer = $target.pointer( options );
$( 'html, body' ).animate( { scrollTop: $target.offset().top - 200 } );
this_pointer.pointer( 'open' );
* Since many of our fields and screens are dynamically loaded, we need to ensure
* the first pointer doesn't start until after they are loaded. But, we can set those
* JS files as dependencies as we these pointers could be loaded on any admin screen.
if ( 0 < pumPointers.pointers.length ) {