Skip to content

Instantly share code, notes, and snippets.

Working hard reviewing and deploying code

Scott Kingsley Clark sc0ttkclark

Working hard reviewing and deploying code
View GitHub Profile
sc0ttkclark / example-attendees-orm-01-get-attendees.php
Last active Feb 13, 2021
Event Tickets Attendees ORM examples
View example-attendees-orm-01-get-attendees.php
* Get a list of attendees.
// Set the provider. This can be default (all attendees of any type), tribe-commerce, rsvp, woo, or edd.
$provider = 'default';
// Get the ORM object set up.
sc0ttkclark / event-tickets-emails-ical-gcal-links.php
Last active Jan 28, 2021
Add iCal / Google Calendar links to Event Tickets emails
View event-tickets-emails-ical-gcal-links.php
sc0ttkclark / functions.php
Last active Jan 27, 2021 — forked from skyshab/functions.php
Reset failed payout status for CT on Order status toggle
View functions.php
add_action( 'woocommerce_order_status_changed', 'rt_ct_reset_failed_payouts', 9, 4 );
function rt_ct_reset_failed_payouts( $order_id, $status_from, $status_to, $order ) {
if ( 'completed' === $status_to ) {
$payouts = tribe_payouts();
// Get payouts by Order ID.
$payouts->by( 'order', $order_id );
sc0ttkclark / remove-empty-wc-orders.php
Last active Jan 25, 2021
Filter empty/invalid orders when refunded orders returns false values.
View remove-empty-wc-orders.php
// Filter the orders returned by WooCommerce so that any missing ones are removed from the list.
add_filter( 'woocommerce_order_query', static function( $posts ) {
// For some reason, $posts may not be an array. Some other plugin(s) may be using the filter incorrectly.
if ( is_array( $posts ) ) {
$posts = array_filter( $posts );
return $posts;
sc0ttkclark / wc-force-regenerate-attendees.php
Last active Jan 22, 2021 — forked from skyshab/example.php
This snippet will add functionality that adds a new "Regenerate Attendees" action and bulk action for WooCommerce order management.
View wc-force-regenerate-attendees.php
// Register the action for the Edit order screen.
add_filter( 'woocommerce_order_actions', 'tec_event_tickets_plus_wc_register_force_regenerate_attendees' );
// Register the bulk action for the Orders screen.
add_filter( 'bulk_actions-edit-shop_order', 'tec_event_tickets_plus_wc_register_force_regenerate_attendees' );
* Register the custom action to the list of order actions.
sc0ttkclark / my-custom-pods-block-1.php
Last active Sep 24, 2020
Pods Blocks API examples for register a custom block type or a custom block collection. Screencast:
View my-custom-pods-block-1.php
* Plugin Name: My Custom Pods Block
* Plugin URI:
* Description: Custom block built using the Pods Block PHP API. No Javascript needed!
* Author Name: Scott Kingsley Clark
* Author URI:
sc0ttkclark /
Last active Aug 8, 2020
Filter the relationship field to allow for selecting multiple post types or multiple taxonomies.

These filters will automatically tell Pods relationship fields to support multiple post types or taxonomies instead of just being tied to one. This is done by changing the default where clause used by Pods to determine what kind of content is returned for the various areas of input (selects, checkboxes, list fields, ajax autocomplete, etc). This is by far the simplest way to customize a related field, but it also has it's drawbacks (see notes below).

Important notes

You must relate the relationship field itself to a NON-POD, any post type not created or extended by Pods will do. The same goes for taxonomies. Don't worry, this doesn't mean you are unable to relate your field to any other Pod, it's just the field setting itself that needs to be set. Your filtering below will handle what it's going to truly be working with from a relationship aspect.

Failing to do this will cause any data you save to not be returned by Pods because when a relationship is related to a Pod it has extra checks to limit

sc0ttkclark / skc-404.php
Created Jul 3, 2020
My 404 handler for
View skc-404.php
* Handle 404's in a way that can trick Slack and other link previews.
function skc_404_handler() {
if ( is_admin() || ! is_404() ) {
View rest.json
"namespace": "pods/v1",
"routes": {
"/pods/v1": {
"namespace": "pods/v1",
"methods": [
"endpoints": [
View pods-help.php
$search = sanitize_text_field( $search );
$query = array();
$query[] = 'brand.meta_value = ' . absint( $_REQUEST['brand_id'] );
$query[] = '
d.asset_name LIKE "%' . pods_sanitize_like( $search ) . '%"
OR product_d.sku like "%' . pods_sanitize_like( $search ) . '%"