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
# /etc/nginx/snippets/wordpress/common.conf | |
index index.php; | |
# Deny all attempts to access hidden files such as .htaccess, .htpasswd, .DS_Store (Mac). | |
location ~ /\. { | |
deny all; | |
} | |
# Block PHP files in uploads, content, and includes directory. | |
location ~* /(?:uploads|files|wp-content|wp-includes)/.*\.php$ { |
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 /* Template Name: Contact Page */ | |
$response = ""; | |
//function to generate response | |
function my_contact_form_generate_response($type, $message){ | |
global $response; | |
if($type == "success") $response = "<div class='alert alert-success'>{$message}</div>"; | |
else $response = "<div class='alert alert-danger'>{$message}</div>"; |
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
#!/usr/bin/env bash | |
# WP-CLI Back up Script to Amazon S3 | |
# Source: https://www.jonathan.vc | |
# Author: Jonathan Dingman | |
# Adapted from Mike at WP Bullet | |
#define local path for backups | |
BACKUPPATH=/tmp/backups | |
#path to WordPress installations |
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
add_filter( 'plugins_auto_update_enabled', '__return_false' ); | |
add_filter( 'themes_auto_update_enabled', '__return_false' ); | |
define( 'automatic_updater_disabled', true ); | |
define( 'wp_auto_update_core', 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
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 ); |
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 webp_is_displayable($result, $path) { | |
if ($result === false) { | |
$displayable_image_types = array( IMAGETYPE_WEBP ); | |
$info = @getimagesize( $path ); | |
if (empty($info)) { | |
$result = false; | |
} elseif (!in_array($info[2], $displayable_image_types)) { | |
$result = false; | |
} else { |
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 add_security_question_fields() { | |
$num1=rand(1,9); | |
$num2=rand(2,9); | |
echo "<p><label for='math' class='small'>Captcha:$num1 + $num2 = ? </label><input type='text' name='sum' class='input' value='' size='25'>" | |
."<input type='hidden' name='num1' value='$num1'>" | |
."<input type='hidden' name='num2' value='$num2'></p>";} | |
add_action('register_form','add_security_question_fields'); | |
add_action( 'register_post', 'add_security_question_validate', 10, 3 ); | |
function add_security_question_validate( $sanitized_user_login, $user_email, $errors){ |
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
add_filter( 'woocommerce_product_add_to_cart_url', 'elftoy_fix_for_individual_products', 10, 2 ); | |
function elftoy_fix_for_individual_products( $add_to_cart_url, $product ){ | |
if( $product->get_sold_individually() // if individual product | |
&& WC()->cart->find_product_in_cart( WC()->cart->generate_cart_id( $product->id ) ) // if in the cart | |
&& $product->is_purchasable() // we also need these two conditions | |
&& $product->is_in_stock() ) { | |
$add_to_cart_url = wc_get_checkout_url(); | |
} | |
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
add_filter( 'woocommerce_add_to_cart_redirect', function( $wc_cart_url ) { | |
return wc_get_checkout_url(); | |
} ); |
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 wpsites_disable_self_pingbacks( &$links ) { | |
foreach ( $links as $l => $link ) | |
if ( 0 === strpos( $link, get_option( 'home' ) ) ) | |
unset($links[$l]); | |
} | |
add_action( 'pre_ping', 'wpsites_disable_self_pingbacks' ); |
OlderNewer