Skip to content

Instantly share code, notes, and snippets.

View crewstyle's full-sized avatar
💭
Good mood! Wanna try new tools for WordPress

Achraf Chouk crewstyle

💭
Good mood! Wanna try new tools for WordPress
View GitHub Profile
@crewstyle
crewstyle / functions.php
Last active April 20, 2016 08:30
WordPress ~ Make medias works in all browsers (such as Safari) - #backend #optimisation
<?php
/**
* Sanitize filenames.
*
* This script has been made because of a bug on Safari which
* does not display medias if its name contains special character
* such as "é", "à" or a simple " ".
* This script transform all these specials to prevent this bug.
*
@crewstyle
crewstyle / functions.php
Last active September 30, 2018 07:00
WordPress ~ Clean head HTML tag - #frontend #optimisation
<?php
/**
* Define what to clean from the theme header frontend, via the "remove_action" hook.
*
* @see https://github.com/GetOlympus/Zeus-Core
*/
$optims = [
'adjacent_posts_rel', // Removes the next and previous post links from the header
@crewstyle
crewstyle / functions.php
Last active April 20, 2016 08:30
WordPress ~ Remove emojicons scripts - #frontend #backend #optimisation
<?php
/**
* Disable emojicons introduced with WP 4.2 in frontend panel.
*
* @uses remove_action()
* @uses add_filter()
* @see https://github.com/crewstyle/clean-wordpress
*/
add_action('init', '_cw_disable_wp_emojicons');
@crewstyle
crewstyle / functions.php
Last active April 20, 2016 08:17
WordPress ~ Remove admin bar - #frontend #optimisation
<?php
//Remove admin bar since WP v3.1
add_filter('show_admin_bar', '__return_false');
remove_action('init', 'wp_admin_bar_init');
@crewstyle
crewstyle / functions.php
Last active April 20, 2016 08:18
WordPress ~ Remove WordPress version in head HTML tag - #frontend #security #optimisation
<?php
//Remove WordPress version.
//<meta name="generator" content="WordPress __WP_VERSION__" />
remove_action('wp_head', 'wp_generator');
/**
* Remove WordPress generator info.
*
* @see https://github.com/crewstyle/clean-wordpress
@crewstyle
crewstyle / functions.php
Last active March 9, 2019 12:56
WordPress ~ Close database connections - #security #optimisation
<?php
/**
* Close database connections
*
* It's very dangerous to let connections opened. In a website
* with high traffic volume, you can kill your database just
* because of unclosed DB connections.
* This little snippet prevent that drama ;)
*