MemberPress: Free-Views-Left Counter

function mepr_display_cookie() { if ( isset( $_COOKIE[‘mp3pi141592pw’] ) && ! empty( $_COOKIE[‘mp3pi141592pw’] ) ) { $cookie = $_COOKIE[‘mp3pi141592pw’]; $mepr_options = MeprOptions::fetch(); $num_views = base64_decode( $cookie ); if ( $num_views < $mepr_options->paywall_num_free_views ) { $free_views = $mepr_options->paywall_num_free_views – $num_views; echo ‘You…Continue reading

MemberPress: Redirect To Specific Page Based on Rule

function mepr_redirect_specific_page( $redirect_url, $delim, $uri ) { $current_post = MeprUtils::get_current_post(); $rules = MeprRule::get_rules( $current_post ); if ( !empty( $rules ) ) { $rule_ids = array_column( $rules, ‘ID’ ); if ( in_array( 123, $rule_ids ) ) { $redirect_url = ‘https://yourdomain.com/register/membership-1/’; }…Continue reading

Using Conditional Logic to Change Date Picker Locale

/** * Conditionally apply the date picker locale strings, depending on what the * current locale is as defined by WPML. * * @link https://wpforms.com/developers/localize-the-date-picker-strings/ */ function wpf_dev_datepicker_apply_locale() { if ( defined( ‘ICL_LANGUAGE_CODE’ ) && ‘es’ == ICL_LANGUAGE_CODE ) {…Continue reading

Localizing Date Picker Strings

/** * Load the date picker locale strings. * * @link https://wpforms.com/developers/localize-the-date-picker-strings/ */ function wpf_dev_datepicker_locale( $forms ) { if ( true === wpforms_has_field_type( ‘date-time’, $forms, true )){ wp_enqueue_script( ‘wpforms-datepicker-locale’, ‘https://npmcdn.com/[email protected]/dist/l10n/es.js’, array( ‘wpforms-flatpickr’ ), null, true ); } } add_action( ‘wpforms_frontend_js’,…Continue reading

Disable All UpdraftPlus Email Notifications

/** * Comprehensive UpdraftPlus Email Notification Disabler * Add this code to your theme’s functions.php or WPCode * By: Empathy First Media */ // Master switches and initialization prevention add_filter(‘updraftplus_disable_all_mail_init’, ‘__return_true’); // Master switch to disable email initialization add_filter(‘updraftplus_email’, ‘__return_false’);…Continue reading

Disabilitazione wp v2 users rest api

// Disable /users rest routes add_filter(‘rest_endpoints’, function( $endpoints ) { if ( isset( $endpoints[‘/wp/v2/users’] ) ) { unset( $endpoints[‘/wp/v2/users’] ); } if ( isset( $endpoints[‘/wp/v2/users/(?P[\d]+)’] ) ) { unset( $endpoints[‘/wp/v2/users/(?P[\d]+)’] ); } return $endpoints; });Continue reading