Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Van Winkle mikevanwinkle

View GitHub Profile
View gist:4162741
// tack on any additional query vars
$redirect['query'] = preg_replace( '#^\??&*?#', '', $redirect['query'] );
if ( $redirect_url && !empty($redirect['query']) ) {
parse_str( $redirect['query'], $_parsed_query );
$redirect = @parse_url($redirect_url);
if ( ! empty( $_parsed_query['name'] ) && ! empty( $redirect['query'] ) ) {
parse_str( $redirect['query'], $_parsed_redirect_query );
View gist:5731256
<?php
/**
Plugin Name: WPE Debug Queries
Description: WPE Plugin for debuging query issues.
**/
if( isset( $_REQUEST['wpe_check_queries'] ) )
{
define("SAVEQUERIES",true);
add_action('wpe_filtered_output','wpe_shutdown_db');
View gist:8414122
<?php
/**
* disables a fast 404 optimization
**/
function wpewa20140105() {
header('wpengine-workaround-20140105: present');
$unhook = array(WpeCommon::instance(), 'is_404');
remove_action('template_redirect', $unhook, 100);
remove_action('bp_init', $unhook, 100);
View gist:339504cbd2759f2c65fb
<?php
// line 410 of modules/update/update.module
// See if the .info file is newer than the last time we checked for data,
// and if so, mark this project's data as needing to be re-fetched. Any
// time an admin upgrades their local installation, the .info file will
// be changed, so this is the only way we can be sure we're not showing
// bogus information right after they upgrade.
if ($project['info']['_info_file_ctime'] > $available[$key]['last_fetch']) {
$available[$key]['fetch_status'] = UPDATE_FETCH_PENDING;
View gist:c99093e3f861c9bbad64
location ~ /oldlink/(.*) {
rewrite ^/oldlink/(.*)$ /newlink/$1 permanent;
}
View ajax-action.php
add_action( 'wp_ajax_nopriv_ajax_pagination', 'my_ajax_pagination' );
add_action( 'wp_ajax_ajax_pagination', 'my_ajax_pagination' );
function my_ajax_pagination() {
echo get_bloginfo( 'title' );
die();
}
View gist:501134ce8ce83a230317
add_action('wp_install', function() {
global $wpdb;
$query = $wpdb->prepare("INSERT INTO %sposts", array( $wpdb->prefix ));
$wpdb->query($query);
});
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

You can’t perform that action at this time.