: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
function onDeleteCancelled() {
$that.css('pointer-events', 'all');
// Code when deletion is cancelled
console.log('Deletion cancelled.');
$('#instagram-form').on('submit', function (e) {
e.preventDefault(); // Prevent default form submission
if ($('#instagram-form p').length > 0) {
$('#instagram-form p').remove();
var access_token = $('#instagram-access-token').val();
var account_type = $('#account-option').val();
$('#instagram-form button').text('Connecting...');
$('#instagram-form button').attr('disabled', 'disabled');
url: ajaxurl, // WordPress AJAX URL
action: 'get_instagram_userdata_ajax', // AJAX action hook
access_token: access_token, // Access token data
account_type: account_type, // Access token data
_nonce: embedpressObj.nonce
success: function (response) {
$('#instagram-form button').text('Connect');
$('#instagram-access-token').after(`<p>${response.error}</p>`);
$('#instagram-form button').removeAttr('disabled');
$('#instagram-form p').remove();
$('#instagram-form button').text('Connected');
window.location.reload();
error: function (xhr, status, error) {
$('.instagram-sync-data').on('click', function (e) {
e.preventDefault(); // Prevent default form submission
var access_token = $that.data('acceess-token');
var account_type = $that.data('account-type');
var user_id = $that.data('userid');
// Add or remove the spinner class to start or stop the spinning animation
$that.find('i').addClass('sync-spin'); // Start spinning
$that.attr('disabled', 'disabled');
url: ajaxurl, // WordPress AJAX URL
action: 'sync_instagram_data_ajax', // AJAX action hook
access_token: access_token, // Access token data
account_type: account_type, // Account type data
user_id: user_id, // User ID data
_nonce: embedpressObj.nonce
success: function (response) {
$that.removeAttr('disabled');
$that.removeClass('sync-spin'); // Stop spinning
window.location.reload();
error: function (xhr, status, error) {
$('.calendly-event-copy-link').click(function () {
var eventLink = $(this).data('event-link');
var tempInput = $('<input>');
$('body').append(tempInput);
tempInput.val(eventLink).select();
document.execCommand('copy');
button.find('span').text('Copied!');
button.find('span').text('Copy link');
$('#open-modal-btn').click(function () {
$('.modal-overlay').css('display', 'block');
$('.modal-overlay .close-btn').click(function () {
$('.modal-overlay').css('display', 'none');
$(document).on('click', function (e) {
if (e.target.classList.contains('modal-overlay')) {
$('.modal-overlay').css('display', 'none');
$('.user-profile-link').click(function () {
var linkToCopy = $(this).attr('title');
copyToClipboard(linkToCopy);
alert('Link copied to clipboard: ' + linkToCopy);