Skip to content

Instantly share code, notes, and snippets.

Maurizio miziomon

Block or report user

Report or block miziomon

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@miziomon
miziomon / virtualmin_sf_symlink.sh
Created Aug 26, 2015
Post Domain modification script for Virtualmin. (create a symlink from /home/public_html to virtualbox shared folder)
View virtualmin_sf_symlink.sh
@miziomon
miziomon / gulfile.js
Created Aug 26, 2015
my gulp config
View gulfile.js
/*
* https://github.com/gulpjs/gulp
* http://code.tutsplus.com/tutorials/using-gulp-for-wordpress-automation--cms-23081
* https://markgoodyear.com/2014/01/getting-started-with-gulp/
* http://mattbanks.me/gulp-wordpress-development/
*
*/
var gulp = require('gulp'),
through = require('gulp-through'),
@miziomon
miziomon / remove-emoji.php
Created Jul 28, 2015
Howto remve emoji rendering from WordPress
View remove-emoji.php
/*
* http://www.denisbouquet.com/remove-wordpress-emoji-code/
*
*/
add_action( 'init', function(){
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
@miziomon
miziomon / current-user-filter.php
Last active Aug 29, 2015
WordPress - Filter content by current user
View current-user-filter.php
/*
* @miziomon
* Filter content by current user
*
*/
add_filter('pre_get_posts', function ($query) {
global $pagenow, $user_ID;
if( !current_user_can('administrator') && $query->is_admin && 'upload.php' != $pagenow ){
$query->set('author', $user_ID);
@miziomon
miziomon / .htacess
Last active Aug 29, 2015
blackhole implementation
View .htacess
<ifModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^(phpinfo|wp-signup|phpmyadmin|database|usage|cgi|signup|admin|register|timthumb|function|system|test|t|jsp|asp|aspx)$ blackhole/ [L]
</ifModule>
@miziomon
miziomon / .htaccess
Last active Aug 29, 2015
WordPress - hide default login url and prevent brute force attack
View .htaccess
# START Security settings
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^[custom-login-path]$ wp-login.php?loginkey=[key]&redirect_to=http://%{SERVER_NAME}/wp-admin/index.php [L]
RewriteCond %{HTTP_REFERER} !^http://%{SERVER_NAME}/wp-admin
RewriteCond %{HTTP_REFERER} !^http://%{SERVER_NAME}/wp-login\.php
RewriteCond %{HTTP_REFERER} !^http://%{SERVER_NAME}/[custom-login-path]
@miziomon
miziomon / admin-redirect
Created May 15, 2015
WordPress user admin redirect
View admin-redirect
/**
*
* redirect to homepage if has non "edit_posts" capabilities
*/
add_filter("admin_init", function () {
if (!current_user_can('edit_posts')) {
wp_redirect(WP_HOME);
exit;
@miziomon
miziomon / Restricted access
Last active Aug 29, 2015
WordPress Template scaffolding for restricted are
View Restricted access
<?php
/**
*
* Template Name: Restricted Area
*
*/
if( !is_user_logged_in() ) {
wp_redirect( WP_HOME ); // redirect to home
@miziomon
miziomon / qtranlsate-comment
Created Apr 18, 2014
WordPress qTranslate comment form error
View qtranlsate-comment
/**
* first relase
* fix to get and translate comment error message
*
*/
add_action("pre_comment_on_post", function( $comment_post_ID) {
$comment_author = ( isset($_POST['author']) ) ? trim(strip_tags($_POST['author'])) : null;
$comment_author_email = ( isset($_POST['email']) ) ? trim($_POST['email']) : null;
@miziomon
miziomon / functions.php
Created Mar 26, 2014
WordPress Lazy Pagination
View functions.php
<?php
add_action('wp_ajax_morepage', 'morepage');
add_action('wp_ajax_nopriv_morepage', 'morepage');
/**
*
* posts_per_page have to set with your pagination value
**/
You can’t perform that action at this time.