Skip to content

Instantly share code, notes, and snippets.

@roscabgdn
roscabgdn / .htaccess
Last active April 25, 2016 17:29
# WHITELISTING IP ADDRESSES
# WHITELISTING IP ADDRESSES
<Files wp-login.php>
Order Deny,Allow
Deny from all
# Allow access via this IP address
Allow from xxx.xxx.xxx.xxx
</Files>
@roscabgdn
roscabgdn / .htaccess
Last active April 25, 2016 17:25
Protejarea .htaccess
# PROTECTING THE .HTACCESS FILE
<Files ~ "^.*.([Hh][Tt][Aa])">
Order Allow,Deny
Deny from all
Satisfy all
</Files>
# PROTECT .htaccess
<Files .htaccess>
order allow,deny
@roscabgdn
roscabgdn / .htaccess
Last active April 25, 2016 17:24
Directory browsing
# PROTECTING DIRECTORIES
Options -Indexes
#IndexIgnore *.php
@roscabgdn
roscabgdn / .htaccess
Last active April 25, 2016 17:24
Protect wp-includes folder
<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>
Order deny,allow
Deny from all
<Files ~ ".(xml|css|jpe?g|png|gif|js)$">
Allow from all
</Files>
# PROTECT wpconfig.php
<files wp-config.php>
order allow,deny
deny from all
</files>
@roscabgdn
roscabgdn / functions.php
Created April 14, 2016 14:03 — forked from bentasm1/functions.php
WC Vendors - Notify anyone registering in WooCommerce on Checkout or My Account Page about strong password requirement.
OPTION 1 - Add a warning that you need a stronger password.
/* WC Vendors - Add a "Need a strong password" notice to the My Account Page */
add_action( 'woocommerce_register_form', 'wcvendors_notify_password_myaccount' );
function wcvendors_notify_password_myaccount() {
echo '<strong>Important</strong> -- This site respects your security. We require all new members to use a strong password. If you can not click the Register button, <strong>you need a stronger password</a>.<br><br>';
}
/* WC Vendors - Add a "Need a strong password" notice to the Checkout Page */
add_action( 'woocommerce_after_checkout_registration_form', 'wcvendors_notify_password_checkout' );
function wcvendors_notify_password_checkout() {
@roscabgdn
roscabgdn / Excerpt wysiwyg
Last active April 13, 2016 09:30 — forked from setola/function.php
Wordpress - excerpt with wysiwyg editor
<?php
/**
* This class removes the default excerpt metabox
* and adds a new box with the wysiwyg editor capability
* @author etessore
*/
class TinyMceExcerptCustomization{
const textdomain = '';
const custom_exceprt_slug = '_custom-excerpt';
@roscabgdn
roscabgdn / Turn on maintenance mode WordPress
Last active February 11, 2021 08:50
If you need to go into temporary maintenance mode and close the site to visitors in the meantime, you can enter the below code:
/*
* http://blog.templatetoaster.com/15-useful-code-snippets-for-your-wordpress-site/
*/
function wp_maintenance_mode(){
if(!current_user_can('edit_themes') || !is_user_logged_in()){
wp_die('Maintenance, please come back soon.', 'Maintenance – please come back soon.', array('response' => '503'));
}
}
add_action('get_header', 'wp_maintenance_mode');
/**
* Fix Gravity Form Tabindex Conflicts
* http://gravitywiz.com/fix-gravity-form-tabindex-conflicts/
*/
add_filter( 'gform_tabindex', 'gform_tabindexer', 10, 2 );
function gform_tabindexer( $tab_index, $form = false ) {
$starting_index = 1000; // if you need a higher tabindex, update this number
if( $form )
add_filter( 'gform_tabindex_' . $form['id'], 'gform_tabindexer' );
return GFCommon::$tab_index >= $starting_index ? GFCommon::$tab_index : $starting_index;