Skip to content

Instantly share code, notes, and snippets.

View wpbullet's full-sized avatar
💭
Find me https://guides.wp-bullet.com/codeable-hire

WP Bullet wpbullet

💭
Find me https://guides.wp-bullet.com/codeable-hire
View GitHub Profile
<?php
define('INBOUND_FAST_AJAX' , true );
/**
* Enable Fast Ajax
*/
add_filter( 'option_active_plugins', 'ajax_disable_plugins' );
function ajax_disable_plugins($plugins){
@wpbullet
wpbullet / functions.php
Created September 9, 2017 03:24 — forked from schilke/functions.php
How to load CSS files asynchronously in WordPress (using Scott Jehl's "loadCSS")
<?php
// This is the cleaner code per request of a thread in the LinkedIn group "WordPress"
// ...
// register and enqueue loadCSS
function load_scripts_and_styles() {
// register loadCSS
wp_register_script( 'load-css-async', get_stylesheet_directory_uri() . '/path/to/js/loadCSS.js', array(), '', false );
/**
* Exclude certain post types from nginx cache cleanup by Till Kruss
*
*/
function nginx_cache_excluded_custom_post_types( $post_types ) {
$post_types[] = 'shop_order';
$post_types[] = 'shop_order_refund';
$post_types[] = 'shop_subscription';
$post_types[] = 'ticket';
$post_types[] = 'ticket_reply';
function SetSearchArgs( $formattedArgs, $args = [] ) {
if( isset( $args[ 'post_type' ] ) && ( count( $args[ 'post_type' ] ) > 1 || gettype( $args[ 'post_type' ] ) === 'string' ) ) {
if( gettype( $args[ 'post_type' ] ) === 'array' ) {
$existing_query = $formattedArgs[ 'query' ];
unset( $formattedArgs[ 'query' ] );
$formattedArgs[ 'query' ][ 'function_score' ][ 'query' ] = $existing_query;
@wpbullet
wpbullet / wp-profile-doctor.sh
Last active May 5, 2021 13:24
Autoinstall wp profile and doctor
#!/bin/bash
php -d memory_limit=-1 $(which wp) package install wp-cli/profile-command:@stable --allow-root
php -d memory_limit=-1 $(which wp) package install wp-cli/doctor-command:@stable --allow-root
@wpbullet
wpbullet / clean-wpengine.sh
Created April 23, 2018 02:30
Clean WPEngine config and mu-plugins
# Clean WPEngine variables for use with local clone setups
# Author: Mike from https.//wp-bullet.com
# run this in the root folder where wp-config.php lives
# define wp-config.php path
WPCONFIGPATH="wp-config.php"
# clean up WPE variables from wp-config.php
sed -i '/wpe/d' ${WPCONFIGPATH}
sed -i '/WPE/d' ${WPCONFIGPATH}
cd wp-content/plugins
git clone https://github.com/Mindsize/mindsize-newrelic
cd mindsize-newrelic
composer install
wp plugin activate mindsize-newrelic --skip-plugins --skip-themes --allow-root