Skip to content

Instantly share code, notes, and snippets.

@evrpress
evrpress / send_first_pregnancy_campaing
Last active March 21, 2017 19:07
Sends the first campaign of a drip campaign
add_action( 'mailster_subscriber_subscribed', 'send_first_pregnancy_campaing' );
function send_first_pregnancy_campaing( $subscriber_id ) {
//get subscriber
if ( $subscriber = mailster( 'subscribers' )->get( $subscriber_id ) ) {
$seachstring = "Pregnancy week %d";
$total_weeks = 40;
//no birthdate
@pelmered
pelmered / gist:e5633068658e75ba9a80
Last active October 13, 2021 14:55
Cleanup orphaned ACF data
# This might ruin your database and I do not take any responsibility for that. Backup your database before continuing
!
# Check the results throughly
SELECT * FROM `wp_postmeta`
WHERE `meta_key` IN
( SELECT TRIM(LEADING '_' FROM `meta_key`) AS mk
FROM `wp_postmeta`
WHERE `meta_value` regexp '^field_[0-9a-f]+'
AND `meta_value` NOT IN
@mannieschumpert
mannieschumpert / gist:8886289
Last active August 2, 2020 13:15
Code Examples from Andrew Nacin's "Current User Can Watch This Talk"
<?php
// If you can edit pages, you can edit widgets
add_filter( 'user_has_cap',
function( $caps ) {
if ( ! empty( $caps['edit_pages'] ) )
$caps['edit_theme_options'] = true;
return $caps;
} );