Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am technosailor on github.
  • I am technosailor (https://keybase.io/technosailor) on keybase.
  • I have a public key ASBukfKyoQ_Yb6W8_3tRYnyku9tkjleiNYSZ7xGRbKQCiQo

To claim this, I am signing this object:

dist: trusty
language: php
php:
- 7.0
- 7.1
- 7.2
- 7.3
add_filter( 'request' function( $query_vars ) {
if( isset( $query_vars['feed'] ) ) {
$query_vars['post_type'] = [
'post',
'page'
];
}
return $query_vars;
} );
@technosailor
technosailor / check-plugin-vuln.sh
Created November 23, 2016 20:18
Check all plugins for vulnerabilities via wp-vulnerability-scanner. Requires WP-CLI.
for plugin in `wp plugin list --format=csv | cut -d , -f 1`;
do
wp vuln plugin-check $plugin;
done
@technosailor
technosailor / update-mysql56.sh
Created February 24, 2016 19:05
Updates VVV MySQL 5.5 to 5.6 -- Ubuntu 14.04
#!/bin/bash
# Usage: ./update-mysql56.sh
# Backup of all databases... JUST IN CASE
mysqldump --all-databases --single-transaction --events --user=root --password > ~/all_database_backup.sql
# Remove MySQL 5.5
sudo apt-get remove mysql-server
sudo apt-get autoremove
[audio mp3="http://technosailor.com/wp-content/uploads/MLKDream_64kb.mp3" start="675"][/audio]
class WP_Media_Embed_Start_Time {
public function __construct() {
$this->hooks();
}
public function hooks() {
add_filter( 'shortcode_atts_audio', array( $this, 'add_attributes' ), 10, 3 );
add_filter( 'shortcode_atts_video', array( $this, 'add_attributes' ), 10, 3 );
add_filter( 'wp_audio_shortcode', array( $this, 'add_start_time' ), 10, 5 );
$user_creds = array(
'user_login' => $member_data['member-username'],
'user_password' => $member_data['member-password'],
//'remember' => false
);
$user = wp_signon( $user_creds, true );
if( is_wp_error( $user ) ) {
$result['redirect'] = site_url( '/login/?error=failed_login' );
@technosailor
technosailor / gist:8358491
Created January 10, 2014 17:21
Nothing fancy. Just a way to get your external IP. Useful for dealing with services that you have to have a white listed IP and maybe you have a lot of servers in a cluster and need to know what the external service is seeing. It's like I'm describing my own personal hell right now...
<?php
$json = file_get_contents( 'http://ifconfig.me/all.json' );
$data = json_decode( $json );
echo $data->ip_addr;
@technosailor
technosailor / gist:7976564
Created December 15, 2013 18:45
Saves default WordPress edit page filters as usermeta
<?php
/*
Plugin Name: AB Edit Filter Save
Version: 0.1
Author: Aaron Brazell
Author URI: http://technosailor.com
Description: Saves default WordPress edit page filters as usermeta
License: GPLv2
*/
class AB_Filter_Save {