Skip to content

Instantly share code, notes, and snippets.

View prevent-image-hotlinkg
/* Prevent image hotlinking in WordPress */
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?il tuo sito.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?google.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?facebook.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?twitter.com [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?altrosito.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ - [F]
View load-jquery-googlecdn
add_action('init', 'use_jquery_from_google');
function use_jquery_from_google () {
if (is_admin()) {
return;
}
global $wp_scripts;
if (isset($wp_scripts->registered['jquery']->ver)) {
$ver = $wp_scripts->registered['jquery']->ver;
View load-jquery-googlecdn
add_action('init', 'use_jquery_from_google');
function use_jquery_from_google () {
if (is_admin()) {
return;
}
global $wp_scripts;
if (isset($wp_scripts->registered['jquery']->ver)) {
$ver = $wp_scripts->registered['jquery']->ver;
@tuttowp
tuttowp / disable-autolinking
Created May 30, 2019
disablita il autolinking dentro i commenti di wordpress
View disable-autolinking
remove_filter( 'comment_text', 'make_clickable', 9 );
@tuttowp
tuttowp / rem-url-comm
Created May 30, 2019
rimuovi il campo url dal formulario dei commenti su wordpress
View rem-url-comm
// Disable Comments URL field
function jlwp_disable_comment_url($fields) {
unset($fields['url']);
return $fields;
}
add_filter('comment_form_default_fields','jlwp_disable_comment_url');
@tuttowp
tuttowp / rimuovi-ping-track
Created May 30, 2019
Rimuovi i pingback quando linki ad un tuo articolo
View rimuovi-ping-track
function no_self_ping( &$links ) {
$home = get_option( 'home' );
foreach ( $links as $l => $link )
if ( 0 === strpos( $link, $home ) )
unset($links[$l]);
}
add_action( 'pre_ping', 'no_self_ping' );
View revisiones-limit
define('AUTOSAVE_INTERVAL', 600);
define('WP_POST_REVISIONS', 3);
View espire-header
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
View compressioni-gzip-nginx
gzip on;
gzip_comp_level 2;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/html text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;
# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";
View errore-failed-to-open-stream-wp
Warning: require(/home/website/wp-includes/load.php): failed to open stream: No such file or directory in /home/website/wp-settings.php on line 19
Fatal error: require(): Failed opening required ‘/home/website/wp-includes/load.php’ (include_path=’.:/usr/share/php/:/usr/share/php5/’) in /home/website/wp-settings.php on line 19
Last Error: 2019-02-04 14:52:13: (2) HTTP Error: Unable to connect: ‘fopen(compress.zlib://https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles?start-index=1): failed to open stream: operation failed’
You can’t perform that action at this time.