Skip to content

Instantly share code, notes, and snippets.

@tommcfarlin
tommcfarlin / ajax-reg.js
Last active August 26, 2017 14:08 — forked from csknk/ajax-reg.js
/**
* This file is enqueued by means of wp_enqueue_script() - variables are passed
* in from PHP by means of wp_localize_script()
*
*/
/* TM: We use an anonymous function to invoke the JavaScript. Also refactored for proper
* WordPress coding standards.
*/
(function( $ ) {
@tommcfarlin
tommcfarlin / remove-javascript-from-wordpress-widget.php
Created June 20, 2012 12:58
Removing JavaScript tags from WordPress Widget input fields
/**
* This function is part of the WordPress Widget API.
*
* It's fired when the widget is being updated and using the incoming
* $new_instance to update the values stored in the incoming $old_instance.
*
* We're allowing users to store CSS and HTML in their input field but we're
* stripping out JavaScript tags.
*/
public function update( $new_instance, $old_instance ) {