This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('INBOUND_FAST_AJAX' , true ); | |
/** | |
* Enable Fast Ajax | |
*/ | |
add_filter( 'option_active_plugins', 'ajax_disable_plugins' ); | |
function ajax_disable_plugins($plugins){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Get user's role | |
* | |
* If $user parameter is not provided, returns the current user's role. | |
* Only returns the user's first role, even if they have more than one. | |
* Returns false on failure. | |
* | |
* @param mixed $user User ID or object. | |
* @return string|bool The User's role, or false on failure. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
# The following rule tells Apache that if the requested filename | |
# exists, simply serve it. | |
RewriteCond %{REQUEST_FILENAME} -s [OR] | |
RewriteCond %{REQUEST_FILENAME} -l [OR] | |
RewriteCond %{REQUEST_FILENAME} -d | |
RewriteRule ^.*$ - [NC,L] | |
# The following rewrites all other queries to index.php. The | |
# condition ensures that if you are using Apache aliases to do | |
# mass virtual hosting, the base path will be prepended to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/ Begin Show 180 variations when loading page. | |
function custom_wc_ajax_variation_threshold( $qty, $product ) { | |
return 400; | |
} | |
add_filter( 'woocommerce_ajax_variation_threshold', 'custom_wc_ajax_variation_threshold', 10, 2 ); | |
// END Show 180 variations when loading page. |
NewerOlder