When Update then Slack

// Notify Slack when a plugin, theme, or WordPress core is updated add_action(‘upgrader_process_complete’, ‘notify_slack_updates_v2’, 10, 2); function notify_slack_updates_v2($upgrader_object, $options) { $slackURL = “https://hooks.slack.com/services/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”; // Replace with your Slack Webhook URL $site_name = get_bloginfo(‘name’); // Plugin Updates if ($options[‘type’] === ‘plugin’…Continue reading

WP Simple Pay: Google GA4 Payment Conversion Tracking (copy)

/** * @link https://library.wpcode.com/snippet/j57gxn45/ */ add_action( ‘simpay_payment_receipt_viewed’, /** * Runs the first time the payment confirmation page is viewed. * * @param array $payment_confirmation_data */ function( $payment_confirmation_data ) { // Payment customer data (not used in this example). $customer =…Continue reading

Blocking search from bots

add_action(‘pre_get_posts’, function($query) { if ($query->is_search() && !is_admin()) { $referer = wp_get_referer(); $site_url = get_site_url(); if (empty($referer) || strpos($referer, $site_url) !== 0) { // Block the request early to save CPU header(‘HTTP/1.1 403 Forbidden’); exit; } } });Continue reading

0020 > MFP > CLASS > myfair_Show_Data

// this is the class definition class myfair_Show_Data { public function __construct() { $this->loadShows(); if (isset($this->showList) && is_array($this->showList) && count($this->showList) > 0) { $this->loadShowCustomData(); } } public function loadShows() { $loop = new WP_Query(array( ‘post_type’ => ‘show’, ‘post_parent’ => ‘0’,…Continue reading

Allow SVG uploads for administrator users.

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading

MFP > Client Utilities

/** * ERC Utilities * */ function get_Cid($s_id, $user_id, $insert = null) { if (!$s_id || !$user_id) return null; $user = new WP_User($user_id); // if (!in_array(‘client’, $user->roles)) return null; $show = get_city($s_id) . ‘ ‘ . get_year($s_id); $loop = new…Continue reading