Skip to content

Instantly share code, notes, and snippets.

@sander1
sander1 / gist:c8dd59792597bed18cbe1d14604ff369
Created February 17, 2017 14:23
WordPress: Cleanup Head Tag
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action('wp_head', 'feed_links', 2);
remove_action('wp_head', 'feed_links_extra', 3);
@sander1
sander1 / gist:e7bd6d5c1445667fbba8991d44cf9f0e
Created February 17, 2017 14:24
WordPress: Disable JSON REST API
add_filter('json_enabled', '__return_false');
add_filter('json_jsonp_enabled', '__return_false');
remove_action('wp_head', 'rest_output_link_wp_head', 10);
remove_action('template_redirect', 'rest_output_link_header', 11, 0);
@sander1
sander1 / gist:e38b7fa7686468646c8edc765232511f
Created February 17, 2017 14:25
WordPress: Change Mail From and Return Path
add_filter('wp_mail_from', function($email) {
return '[email protected]';
});
add_filter('wp_mail_from_name', function($name) {
return get_option('blogname');
});
class email_return_path {
function __construct() {
@sander1
sander1 / preview.sh
Last active August 29, 2019 09:22
Video preview script from https://davidwalsh.name/video-preview
sourcefile=$1
destfile=$2
# Overly simple validation
if [ ! -e "$sourcefile" ]; then
echo 'Please provide an existing input file.'
exit
fi
if [ "$destfile" == "" ]; then
@sander1
sander1 / wp_kses_post_tags.php
Created August 20, 2017 19:02 — forked from bjorn2404/wp_kses_post_tags.php
WordPress allow iFrames with wp_kses_post filter
<?php
/**
* Add iFrame to allowed wp_kses_post tags
*
* @param string $tags Allowed tags, attributes, and/or entities.
* @param string $context Context to judge allowed tags by. Allowed values are 'post',
*
* @return mixed
*/
docker run -d -p <PORT_OF_YOUR_CHOICE>:6379 redis