Skip to content

Instantly share code, notes, and snippets.

View mahdiyazdani's full-sized avatar
:bowtie:
Still Rocking!

Mahdi Yazdani mahdiyazdani

:bowtie:
Still Rocking!
View GitHub Profile
@mahdiyazdani
mahdiyazdani / turn-off-cache-for-all-browsers-with-meta.html
Created September 24, 2016 23:50
Using <meta> tags to turn off caching in all browsers
<meta http-equiv="cache-control" content="max-age=0" />
<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="expires" content="0" />
<meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" />
<meta http-equiv="pragma" content="no-cache" />
@mahdiyazdani
mahdiyazdani / change-wp-admin-footer-text.php
Created September 24, 2016 23:56
Change WordPress admin area footer text
@mahdiyazdani
mahdiyazdani / hide-php-warning-and-errors-in-wordpress.php
Last active September 24, 2016 23:57
Hide PHP Warnings and Errors in WordPress
<?php
/**
* Replace this line from your wp-config.php file
* "define('WP_DEBUG', false);"
* with these commands below.
*/
ini_set('log_errors', 'On');
ini_set('display_errors', 'Off');
ini_set('error_reporting', E_ALL);
define('WP_DEBUG', false);
@mahdiyazdani
mahdiyazdani / gzip-compression-for-wordPress.txt
Created September 29, 2016 23:35
Gzip Compression for WordPress
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
@mahdiyazdani
mahdiyazdani / disable-emoji.php
Last active September 29, 2016 23:46
Disable the emoji's
<?php
/**
* Disable the emoji's
*/
function disable_emojis()
{
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('admin_print_scripts', 'print_emoji_detection_script');
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action('admin_print_styles', 'print_emoji_styles');
@mahdiyazdani
mahdiyazdani / disable-hotlinking.txt
Created September 29, 2016 23:48
Disable Hotlinking
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?yourdomain.com [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]
@mahdiyazdani
mahdiyazdani / add-expire-headers-to-wordpress.txt
Last active September 30, 2016 09:42
Add Expire Headers to WordPress
# Browser Caching – Add Expire Headers to WordPress
# BEGIN Expire headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
ExpiresByType image/x-icon "access plus 2592000 seconds"
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
@mahdiyazdani
mahdiyazdani / add-shortcode-to-text-widget.php
Created October 16, 2016 17:41
Adding Shortcodes to Widgets
<?php
add_filter( 'widget_text', 'do_shortcode' );
@mahdiyazdani
mahdiyazdani / remove-wordpress-version-number.php
Created October 16, 2016 17:43
Remove the WordPress Version Number
<?php
remove_action('wp_head', 'wp_generator');
@mahdiyazdani
mahdiyazdani / hide-wordpress-update-message.php
Created October 16, 2016 17:44
Hide the WordPress Update Message
<?php
// Hide WordPress Update
function my_hide_update() {
remove_action('admin_notices', 'update_nag', 3);
}
add_action('admin_menu','my_hide_update');