Skip to content

Instantly share code, notes, and snippets.

<form method="GET" class="wine-search">
<label for="varieties">All varieties:</label>
<select name="varieties[]" id="varieties">
<option value="" disabled selected>Select a variety</option>
<?php
$svarieties = get_terms([
'taxonomy' => 'varieties',
'hide_empty' => false,
]);
/** Disable Ajax Call from WooCommerce on front page and posts*/
add_action( 'wp_enqueue_scripts', 'fixmysite_dequeue_woocommerce_cart_fragments' );
function fixmysite_dequeue_woocommerce_cart_fragments() {
if( function_exists( 'is_woocommerce' ) ){
if (is_front_page() || is_single() ) {
wp_dequeue_script('wc-cart-fragments');
}
/** Disable All WooCommerce Styles and Scripts Except Shop Pages*/
add_action( 'wp_enqueue_scripts', 'fixmysite_disable_woocommerce_loading_css_js' );
function fixmysite_disable_woocommerce_loading_css_js() {
if( function_exists( 'is_woocommerce' ) ){
// Check if it's any of WooCommerce page
if(! is_woocommerce() && ! is_cart() && ! is_checkout() ) {
## Dequeue WooCommerce styles
# Deny xmlrpc.php
<files xmlrpc.php>
order allow,deny
deny from all
</files>
# Deny wp-config.php
<files wp-config.php>
order allow,deny
deny from all
</files>
# Deny wp-config.php
<files wp-config.php>
order allow,deny
deny from all
</files>
# Kill PHP Execution
<Files ~ "\.ph(?:p[345]?|t|tml)$">
deny from all
</Files>
# Block the include-only files.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^wp-admin/includes/ - [F,L]
RewriteRule !^wp-includes/ - [S=3]
RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]
RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]
RewriteRule ^wp-includes/theme-compat/ - [F,L]
</IfModule>
/** MySQL database password */
define('DB_PASSWORD', 'password_here');
/**
* Authentication Unique Keys and Salts.
* You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
*/
define('AUTH_KEY', 'put your unique phrase here');
define('SECURE_AUTH_KEY', 'put your unique phrase here');
define('LOGGED_IN_KEY', 'put your unique phrase here');
<?php
# Fill our vars and run on cli
# $ php -f db-connect-test.php
$dbname = 'name';
$dbuser = 'user';
$dbpass = 'pass';
$dbhost = 'host';
$link = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysqli_select_db($link, $dbname) or die("Could not open the db '$dbname'");
$test_query = "SHOW TABLES FROM $dbname";