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

change search url

function wpb_change_search_url() { if ( is_search() && ! empty( $_GET[‘s’] ) ) { wp_redirect( home_url( “/search/” ) . urlencode( get_query_var( ‘s’ ) ) ); exit(); } } add_action( ‘template_redirect’, ‘wpb_change_search_url’ );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 > Frontend Utilities

add_filter(‘the_title’, ‘the_title_trim’); function the_title_trim($title) { $findthese = array( ‘#Protected:#’, ‘#Private:#’ ); $replacewith = array( ”, // What to replace “Protected:” with ” // What to replace “Private:” with ); $title = preg_replace($findthese, $replacewith, $title); return $title; } function do_accordion($title, $content,…Continue reading