ACF JSON Menu Import

if( function_exists(‘acf_add_options_page’) ) { acf_add_options_page(); } // // 1. Register ACF Field for Menu JSON add_action(‘acf/init’, function() { if( function_exists(‘acf_add_local_field_group’) ) { acf_add_local_field_group(array( ‘key’ => ‘group_menu_json_import’, ‘title’ => ‘Menu Import’, ‘fields’ => array( array( ‘key’ => ‘field_menu_json’, ‘label’ => ‘Menu…Continue reading

Retrieve Card Details from Stripe Checkout One-Time Payments

add_filter( ‘simpay_payment_confirmation_template_tag_card-last4’, function( $value, $payment_confirmation_data ) { if ( isset( $payment_confirmation_data[‘checkout_session’] ) && ! isset( $payment_confirmation_data[‘subscription’] ) ) { $paymentintent = \SimplePay\Core\API\PaymentIntents\retrieve( array( ‘id’ => $payment_confirmation_data[‘checkout_session’]->payment_intent, ‘expand’ => array( ‘latest_charge’, ), ), $payment_confirmation_data[‘form’]->get_api_request_args() ); $card = $paymentintent->latest_charge->payment_method_details->card; return $card->last4; }…Continue reading

Fetch Quiz Data by Quiz id

// Author: Sumaiya, Clickup Doc : https://app.clickup.com/36636088/v/dc/12y1dr-22535/12y1dr-24415 add_action(‘wp_ajax_fetch_quiz_data’, ‘fetch_quiz_data’); add_action(‘wp_ajax_nopriv_fetch_quiz_data’, ‘fetch_quiz_data’); // For non-logged in users function get_quiz_data($quiz_id) { global $wpdb; // Sanitize the quiz ID to prevent SQL injection and other security issues. $quiz_id = sanitize_text_field($quiz_id); $table_name = ‘quiz_answers’;…Continue reading

MemberPress: Remove MemberPress Weekly Stats Widget from WordPress Dashboard

function mepr_remove_dashboard_widgets() { global $wp_meta_boxes; // Unset the MemberPress Weekly Stats widget from the dashboard unset( $wp_meta_boxes[‘dashboard’][‘normal’][‘core’][‘mepr_weekly_stats_widget’] ); } // Hook the function into the WordPress dashboard setup action add_action( ‘wp_dashboard_setup’, ‘mepr_remove_dashboard_widgets’, 99 );Continue reading

MemberPress: Exclude Protected Posts From the Main Query

function mepr_exclude_protected_posts_from_query_block( $query ) { if (! is_admin() && $query->is_main_query()) { $posts_to_exclude = array(); $posts = get_posts(array(‘post_type’ => ‘post’, ‘posts_per_page’ => -1)); foreach ($posts as $post) { if (MeprRule::is_locked($post)) { $posts_to_exclude[] = $post->ID; } } if (! empty($posts_to_exclude)) { $query->set(‘post__not_in’,…Continue reading

MemberPress: Kit (formerly ConvertKit) – Remove Kit Inactive Tag for Inactive Subscribers

// Remove the inactive tag function mepr_remove_ck_inactive_tag_from_subscriber($txn) { $contact = $txn->user(); $enabled = (bool)get_post_meta($txn->product_id, ‘_meprconvertkit_tag_override’, true); $active_tag_id = get_post_meta($txn->product_id, ‘_meprconvertkit_tag_override_id’, true); $inactive_tag_id = get_post_meta($txn->product_id, ‘_meprconvertkit_inactive_tag_override_id’, true); $ck = new MpConvertKit(); // Remove active tag if ($enabled && !empty($active_tag_id)) { $ck->remove_tag_from_subscriber($contact,…Continue reading