This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
delete from wp_posts where post_type in ('product', 'product_variation', 'shop_order'); | |
delete from wp_postmeta where post_id not in (select ID as post_id from wp_posts); | |
delete from wp_comments where comment_post_ID not in (select ID as comment_post_ID from wp_posts); | |
delete from wp_commentmeta where comment_id not in (select comment_ID as comment_id from wp_comments); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* To validate if user accepts terms & conditions | |
*/ | |
add_action( 'pre_jptt_user_register', function () { | |
$accept_terms = (bool) trim( filter_input( INPUT_POST, 'accept_terms', FILTER_SANITIZE_STRING ) ); | |
if ( !$accept_terms ) { | |
$error = new WP_Error( 'no_accept_terms', __( "You must accept terms & conditions to continue", TEXT_DOMAIN ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php | |
*/ | |
$args = array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'rest_api_init', function () { | |
register_rest_route( 'me/favorite', 'add', array( | |
'methods' => 'GET', | |
'callback' => 'rest_test', | |
) ); | |
} ); | |
function wp_send_rest_success( $response = array() ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
'use strict'; | |
// Used to mask behavior of input type file | |
$('.input-group-file').each(function (e, i) { | |
var inputFile = $(i).find('input[type="file"]'); | |
var inputText = $(i).find('input[type=text]'); | |
var inputLabel = $(i).find('label'); | |
// Bind click to use the label behavior in the input text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* CLI for create a virtualhost in Wamp | |
*/ | |
if ( empty( $argv[1] ) ) { | |
echo "A vhost name is required"; | |
return false; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# find /var/www/html/wp-content/uploads/ -type f -empty -iname "*.jpg" -delete | |
# find /var/www/html/wp-content/uploads/ -type f -empty -iname "*.jpeg" -delete | |
# find /var/www/html/wp-content/uploads/ -type f -empty -iname "*.png" -delete | |
# | |
# find /var/www/html/wp-content/uploads/ -type f -iname "*.jpg" -exec jpegoptim --strip-all {} \; | |
# find /var/www/html/wp-content/uploads/ -type f -iname "*.jpeg" -exec jpegoptim --strip-all {} \; | |
# find /var/www/html/wp-content/uploads/ -type f -iname "*.png" -exec optipng {} \; | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Requires root | |
su | |
# mount as read-write | |
mount -o rw,remount,rw /system | |
# Malware? | |
rm /system/priv-app/Xfota.apk | |
rm -r /data/data/com.xbkpnotification | |
# Malware? | |
rm /system/priv-app/EMBI.apk | |
rm -r /data/data/com.syswin.gservices |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function (grunt) { | |
grunt.initConfig({ | |
pkg: grunt.file.readJSON('package.json'), | |
copy: { | |
lib: { | |
files: [ | |
{ | |
expand: true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add $USER to the www-data group | |
sudo usermod -a -G www-data $USER | |
# Change to group | |
sudo chgrp -R www-data /var/www/html | |
# Change propetary | |
sudo chown -R $USER:www-data /var/www/html/ | |
# Update permissions |