Skip to content

Instantly share code, notes, and snippets.

View guillaumemolter's full-sized avatar

Guillaume Molter guillaumemolter

View GitHub Profile
@guillaumemolter
guillaumemolter / plesk-nginx-config-ressources
Last active August 29, 2015 14:02 — forked from rutger1140/gist:8548548
Ressources to configure Plesk (11.5) with NGinx as the main webserver
### /usr/local/psa/admin/conf/templates/custom/domain/nginxDomainVirtualHost.php ###
# Source: https://www.websavers.org/how-to-speed-up-wordpress/
rewrite !\.(js|ico|gif|jpg|png|css|pdf|mov|mp3|eot|svg|ttf|woff|otf|txt|swf)$ /index.php break;
rewrite /wp-admin/$ /wp-admin/index.php break;
rewrite /$ /index.php break;
# enable gzip compression
gzip on;
gzip_min_length 1100;
gzip_buffers 4 32k;
@guillaumemolter
guillaumemolter / wp-autoupdate-config
Created June 6, 2014 16:12
Force all auto updates in WordPress
<?php
define( 'WP_AUTO_UPDATE_CORE', true );
define( 'WP_AUTO_UPDATE_PLUGIN', true );
define( 'WP_AUTO_UPDATE_TRANSLATION', true );
?>
<?php
define('DB_NAME', '');
define('DB_USER', '');
define('DB_PASSWORD', '');
define('DB_HOST', 'localhost');
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');
define('WP_DEBUG', true);
?>
@guillaumemolter
guillaumemolter / partial-wp-config.php
Created October 10, 2014 23:22
Modify wp-config.php for versioning and colloboration by replacing the standard DB_* & WP_DEBUG configs by the following lines.
<?php
/* local-settings.php is gitignored so you can put local config in it see - https://gist.github.com/guillaumemolter/2d746cda246ae018bd8a */
if(file_exists(ABSPATH . 'local-settings.php')){
require_once(ABSPATH . 'local-settings.php');
}
else{
die(ABSPATH . "local-settings.php is missing, please read the repo's readme.md");
}
?>
@guillaumemolter
guillaumemolter / postmarkapp.php
Created October 12, 2014 14:22
Added better $var validation using isset to prevent 'Notice: Undefined' when WP_debug is activated.
<?php
/*
Plugin Name: Postmarkapp Email Integrator
Plugin URI: https://wordpress.org/plugins/postmarkapp-email-integrator/
Description: Overwrites wp_mail to send emails through Postmark. This plugin is a bug fixed edition of the official Postmarkapp plugin
Author: Gagan Deep Singh
Version: 2.1
Author URI: https://gagan.pro
*/
@guillaumemolter
guillaumemolter / wp-config.php
Created September 3, 2015 18:03
Exemple of multisite wp-config with local-settings.php
<?php
/**
* The base configurations of the WordPress.
*
* This file has the following configurations: MySQL settings, Table Prefix,
* Secret Keys, and ABSPATH. You can find more information by visiting
* {@link https://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php}
* Codex page. You can get the MySQL settings from your web host.
*
* This file is used by the wp-config.php creation script during the
@guillaumemolter
guillaumemolter / gist:53c9a6fb8610beec19a5
Last active November 11, 2015 16:10
Disable WordPress default routes and endpoints REST API V1
<?php
function remove_wp_endpoints($default_routes){
$new_routes["/"] = $default_routes["/"];
return $new_routes;
}
add_filter('json_endpoints', 'remove_wp_endpoints', 20, 3);
@guillaumemolter
guillaumemolter / snippet.php
Created November 11, 2015 16:13
Disable WordPress default routes and endpoints REST API V2 - Correct way
<?php
remove_action( 'rest_api_init', 'create_initial_rest_routes', 0 );
@guillaumemolter
guillaumemolter / code-exention-sync.sh
Last active March 3, 2017 15:58
Syncing Visual Code extensions
#!/bin/bash
#Update this with your own path. Mine is in dropbox because I use Tom McFarlin's trick to sync https://tommcfarlin.com/sharing-visual-studio-code-settings/
CODE_PREFS_PATH='/Users/guillaumemolter/Dropbox/Apps/Code/User/extensions.conf'
EXTENSIONS=`cat $CODE_PREFS_PATH`
for EXTENSION in ${EXTENSIONS[@]}
do
code --install-extension $EXTENSION
done
# then add to your .bash_profile :
@guillaumemolter
guillaumemolter / wp-cli-multisite-cheat-sheet.sh
Created March 9, 2017 20:22
A list of usefull commands to maitain a WordPress multisite install using WP-CLI
# Network wide search and replace
wp search-replace 'NEEDLE' 'HAYSTACK' --network --verbose
# Network wide search and replace for domain (ie: prod to dev DB migration)
wp search-replace 'old.domain.com' 'new.domain.com' --network --verbose --url=old.domain.com
# Network wide rewrite rules and permalinks flush
wp site list --field=url | xargs -n1 -I % wp rewrite flush --url=%