Skip to content

Instantly share code, notes, and snippets.

@villesiltala
villesiltala / obfuscate-wp-users.php
Last active November 13, 2023 03:40
Obfuscate WordPress user data
<?php
/**
* This script obfuscates WordPress user data for defined user roles.
*/
global $wpdb;
// This example obfuscates all user data for WooCommerce customers.
$roles = [
'customer',

Given a subscribed calendar with a url like

https://example.com/example.ics

To force Google Calendar to refresh and reload the contents right now, unsubscribe from the calendar and subscribe to a new calendar with a URL like

https://example.com/example.ics#1

Adding the anchor tag will force Google Calendar to think of it as a new calendar

@cliffordp
cliffordp / functions.php
Last active July 16, 2021 00:06
Make WooCommerce cart Quantity input field non-editable (readonly) ONLY FOR Event Tickets Plus products
<?php
/**
* Make WooCommerce cart Quantity input field non-editable (readonly) ONLY FOR Event Tickets Plus products
*
* By Matt B and Cliff P
*
* From https://gist.github.com/cliffordp/66bf05df61ee269c60ff20d6f39e2cab
*/
function cliff_etplus_woo_cart_quantity_readonly() {
@cliffordp
cliffordp / functions.php
Last active December 20, 2017 08:04
The Events Calendar - Filter Bar -- make Event Categories filter by AND (in all selected categories) instead of OR (in any selected category, which is the default)
<?php
/**
* !!!
* Old snippet. Use the tribe_events_filter_taxonomy_relationship filter instead.
* https://gist.github.com/cliffordp/c2ea6115318044db219322fea8da55ec
* !!!
*
* By Barry 2016-07-06
* From https://gist.github.com/cliffordp/eb2753491526b079ba69882f4be4fafc
@niconerd-zz
niconerd-zz / tribe_modify_list_widget_args.php
Created January 22, 2016 14:19
The Events Calendar - Limit the upcoming widget to just event running today
/*
* The Events Calendar - Limit the upcoming widget to just event running today
*/
add_filter( 'tribe_events_list_widget_query_args', 'tribe_modify_list_widget_args', 10, 1 );
function tribe_modify_list_widget_args ( $args ) {
$start_date_init = date ( 'Y-m-d' );
$start_date_end = $start_date_init . ' 23:59:59';
@daltonrooney
daltonrooney / file-upload-handler.php
Created February 4, 2012 13:29
Multi-file WordPress uploads from the front-end
<?php /* This function attaches the image to the post in the database, add it to functions.php */
function insert_attachment($file_handler,$post_id,$setthumb='false') {
// check to make sure its a successful upload
if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();
require_once(ABSPATH . "wp-admin" . '/includes/image.php');
require_once(ABSPATH . "wp-admin" . '/includes/file.php');
require_once(ABSPATH . "wp-admin" . '/includes/media.php');