function cm_warning() {
	const cm_home = window.location.href.split('&')[0];

	warningHtml = `
		<p>
			Adding custom code may introduce incompatibilities that break your site. Here are some guidelines to keep in mind when writing custom code:
		</p>
		<ul>
			<li>Do NOT copy code into the Code Manager you don’t understand</li>
			<li>Do NOT copy code from the internet into the Code Manager if you’re not sure what the code does</li>
			<li>Know what you do, do what you know</li>
		</ul>
		<p>
			Bookmark these links in case your code results in failures:
		</p>
		<ul>
			<li>
				<a href="${cm_home}">
					Your Code Manager admin page
				</a>
			</li>
			<li>
				<a href="https://code-manager.com/blog/docs/index/getting-started/read-this-first/" target="_blank">
					Four alternatives to disable faulty code
				</a>
			</li>
		</ul>
		<div>
			<label>
				<input type="checkbox" id="code_manager_message_off" /> Don't show this message again
			</label>		
		</div>
	`;

	var dialog = jQuery("<div/>").html(warningHtml).dialog({
		title: "Heads up!",
		width: "max-content",
		dialogClass: "code-manager-dialog",
		modal: true,
		autoOpen: true,
		closeOnEscape: false,
		draggable:false,
		resizable: false,
		buttons: {
			"Go back": function() {
				cm_message_off();
				window.location.href = cm_home;
			},
			"I understand": function() {
				cm_message_off();
				dialog.dialog("destroy");
			}
		}
	});
}

function cm_message_off() {
	if (jQuery("#code_manager_message_off").is(":checked")) {
		// turn off alert
		jQuery.ajax({
			type: 'POST',
			url: pathname + '?action=code_manager_alert_off',
			data: {
				wpnonce: wpnonce
			}
		});
	}
}