Ultimate Member Fallback Value

/** * Displays fallback value if the field value is empty. For the “view” mode only. * @param string $value * @param string $default * @param string $key * @param string $type * @param array $data * @return string */…Continue reading

Pipeline API Auto Sync

add_action(‘init’, ‘pipeline_save_api_data_to_static_json’); function pipeline_save_api_data_to_static_json() { if (!is_main_query() || !is_admin()) return; if (isset($_GET[‘run_pipeline_sync’]) && current_user_can(‘manage_options’)) { pipeline_run_api_sync(); exit(‘Sync completed’); } } function pipeline_run_api_sync() { $auth_url = ‘https://pipeline-wp-api.locallabs.com/api/v2/authenticate’; $email = defined(‘PIPELINE_API_EMAIL’) ? PIPELINE_API_EMAIL : ”; $password = defined(‘PIPELINE_API_PASSWORD’) ? PIPELINE_API_PASSWORD : ”;…Continue reading

Breeze Auto Cache Clear > Wp All Import

add_action(‘pmxi_saved_post’, ‘trigger_breeze_secure_cache_purge’, 10, 1); function trigger_breeze_secure_cache_purge($post_id) { $url = home_url(‘/wp-json/breeze/v1/purge’); $response = wp_remote_post($url, [ ‘headers’ => [ ‘Content-Type’ => ‘application/json’, ‘Authorization’ => ‘Bearer NH1QZ2zi0aef’, // your Breeze API key ], ‘body’ => json_encode([ ‘urls’ => [get_permalink($post_id)], // optional: purge only…Continue reading

Staging Subscriber Redirect

function redirect_subscribers_to_home( $redirect_to, $request, $user ) { // Check if user is logged in and is a subscriber if ( isset( $user->roles ) && is_array( $user->roles ) && in_array( ‘subscriber’, $user->roles ) ) { return home_url(); // Redirect to homepage…Continue reading

Add Image Alt Text automatic (copy) (copy)

function add_alt_text_to_images( $html ) { // Check if the image has a title attribute if ( preg_match( ‘/(title=[“‘].*?[“‘])/’, $html, $matches ) ) { // Get the title $title = substr( $matches[0], 7, -1 ); // Check if the image has…Continue reading

Add Image Alt Text automatic (copy)

function add_alt_text_to_images( $html ) { // Check if the image has a title attribute if ( preg_match( ‘/(title=[“‘].*?[“‘])/’, $html, $matches ) ) { // Get the title $title = substr( $matches[0], 7, -1 ); // Check if the image has…Continue reading

Disable Console Logs

$isProduction = true; $triggerWords = [‘.loc’, ‘localhost’, ‘.local’, ‘staging.’, ‘.staging’, ‘.testing’, ‘.dev’]; // edit triggerWords for your setup, these as fairly standard identifiers of non production env // the goal is to check the root url for a string that…Continue reading

MemebrPress: Send Membership-Specific Welcome Email Only When Transaction Is Completed

function send_welcome_email_on_transaction_completed($event) { $txn = $event->get_data(); // Get the transaction data $usr = $txn->user(); // Get the user associated with the transaction MeprUtils::maybe_send_product_welcome_notices($txn, $usr); // Send the membership-specific welcome email } add_action(‘mepr-event-transaction-completed’, ‘send_welcome_email_on_transaction_completed’);Continue reading