Skip to content

Instantly share code, notes, and snippets.

View fasterwp's full-sized avatar
🏠
Working from home

Andrei Chira fasterwp

🏠
Working from home
View GitHub Profile
@fasterwp
fasterwp / delete-generated-wp-images.sh
Created March 22, 2023 15:33 — forked from neverything/delete-generated-wp-images.sh
Sometimes you only want the original images and not the generated sizes <name-of-image>-150x150.png. This command deletes all the files with a certain pattern in the file name. See https://silvanhagen.com/wordpress-delete-generated-images/ for more details.
# List the files
find -E . -type f -regex ".*-[[:digit:]]{2,4}x[[:digit:]]{2,4}(@2x)?.(jpg|jpeg|png|eps|gif)"
# DANGER! Delete the files
find -E . -type f -regex ".*-[[:digit:]]{2,4}x[[:digit:]]{2,4}(@2x)?.(jpg|jpeg|png|eps|gif)" -delete
# If your OS doesn't support -E (tip from https://github.com/quasel)
find . -type f -regextype posix-extended -regex ".*-[[:digit:]]{2,4}x[[:digit:]]{2,4}(@2x)?.(jpg|jpeg|png|eps|gif)"
# Improved with the help of https://github.com/markhowellsmead
@fasterwp
fasterwp / README.md
Created March 20, 2023 18:07 — forked from hofmannsven/README.md
Storing WordPress files and database with WP-CLI on the server.

WordPress Backups with WP-CLI

# TO BE ADDED TO location.main-before
###################################################################################################
# Rocket-Nginx
#
# Rocket-Nginx is a NGINX configuration to speedup your WordPress
# website with the cache plugin WP-Rocket (http://wp-rocket.me)
#
# Author: Maxime Jobin
# URL: https://github.com/maximejobin/rocket-nginx
#
@fasterwp
fasterwp / hide-plugins-if-not-ID.php
Created September 2, 2021 22:44 — forked from wpmudev-sls/hide-plugins-if-not-ID.php
Hides specific menus from any users if they don't have the given ID
<?php
/**
* Plugin Name: Hide Plugins
* Plugin URI: https://premium.wpmudev.org/
* Description: Hides specific plugins from Admin Menus & Plugins List
* Version: 1.0.0
* Author: Konstantinos Xenos @ WPMUDEV
* Author URI: https://premium.wpmudev.org/
* License: GPLv2 or later
@fasterwp
fasterwp / genesis-homepage
Created August 17, 2019 07:00
business-homepage
//* Unregister widgets areas & layouts
unregister_sidebar( 'sidebar-alt' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
//* Register Home Slider widget area
genesis_register_sidebar( array(
'id' => 'home-slider',
@fasterwp
fasterwp / delete-cron
Created December 10, 2018 20:52
delete WP cron
SELECT * FROM `wp_options` WHERE option_name = 'cron'
@fasterwp
fasterwp / enqueue Google fonts
Last active November 14, 2018 21:02
how to add google fonts to toki theme that has only system fotns
wp_enqueue_style(
'google-fonts',
'//fonts.googleapis.com/css?family=Noto+Sans:400,700|Noto+Serif:400,400i,700,700i',
array(),
CHILD_THEME_VERSION
);
@fasterwp
fasterwp / empty-trash
Created June 25, 2018 08:58
set interval to empty WordPress trash
define( 'EMPTY_TRASH_DAYS', 5 );
@fasterwp
fasterwp / post-revisions
Created June 25, 2018 08:57
set post revions in wp-config.php
define( 'WP_POST_REVISIONS', 3 );
@fasterwp
fasterwp / remove-transients
Created June 25, 2018 08:56
mysql query to remove WordPress transients from wp_options table
DELETE FROM `wp_options` WHERE `option_name` LIKE ('%\_transient\_%');