Skip to content

Instantly share code, notes, and snippets.

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]
@mikaelz
mikaelz / delete-all-woocommerce-products.php
Last active April 30, 2024 06:07
Remove all WooCommerce products from database via SQL
<?php
require dirname(__FILE__).'/wp-blog-header.php';
$wpdb->query("DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%')");
$wpdb->query("DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%'");
$wpdb->query("DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy)");
$wpdb->query("DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'))");
$wpdb->query("DELETE FROM wp_posts WHERE post_type IN ('product','product_variation')");
@mindctrl
mindctrl / update-transient-flusher.php
Created February 5, 2015 01:43
Force WordPress to check for plugin and theme updates on every page load. Obviously used for testing. Do not use this full time as it will slow your site down.
<?php
/*
Plugin Name: Updates Transient Flusher
Description: Deletes the update_themes and update_plugins transients. Forces WordPress to check for plugin and theme updates on every page load. FOR TESTING ONLY.
*/
function jp_delete_update_transients() {
delete_transient( 'update_themes' );
delete_transient( 'update_plugins' );
@cfxd
cfxd / shortcode.css
Last active November 17, 2021 05:53
How to Make the WordPress Video Shortcode Responsive. See http://cfxdesign.com/how-to-make-the-wordpress-video-shortcode-responsive
.wp-video, video.wp-video-shortcode, .mejs-container, .mejs-overlay.load {
width: 100% !important;
height: 100% !important;
}
.mejs-container {
padding-top: 56.25%;
}
.wp-video, video.wp-video-shortcode {
max-width: 100% !important;
}
@samhotchkiss
samhotchkiss / gitignore-for-wp
Created August 9, 2013 01:35
Basic Gitignore for WordPress
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@ocean90
ocean90 / box-shadow.html
Last active April 11, 2024 13:54
CSS3 Box Shadow, only top/right/bottom/left and all
<!DOCTYPE html>
<html>
<head>
<title>Box Shadow</title>
<style>
.box {
height: 150px;
width: 300px;
margin: 20px;