WPForms – Create User Smart Tags from the WordPress profile.

/** * Create User Smart Tags from the WordPress profile. * * @link https://wpforms.com/developers/how-to-create-more-user-smart-tags/ */ function wpf_dev_register_user_profile_smart_tags ( $tags ) { // Key is the tag, item is the tag name. $tags[ ‘wp_nickname’ ] = ‘WP Profile Nickname’; $tags[ ‘wp_username’…Continue reading

Move Jump to Recipe above featured image in Genesis (copy)

/** * Ensures the “Jump to Recipe” button is added above the featured image. */ add_action( ‘init’, function(){ if ( method_exists( ‘Tasty_RecipesShortcodes’, ‘filter_the_content_late’ ) ) { remove_filter( ‘the_content’, array( ‘Tasty_RecipesShortcodes’, ‘filter_the_content_late’ ), 100 ); add_action( ‘genesis_before_entry_content’, function() { echo Tasty_RecipesShortcodes::filter_the_content_late(…Continue reading

MemberPress: Bulk Delete All Expired Subscriptions

function mepr_delete_expired_txns() { $subscriptions = MeprSubscription::get_all(); if( is_array( $subscriptions ) && !empty( $subscriptions ) ) { foreach( $subscriptions as $subscription ) { $subscription = new MeprSubscription( $subscription->id ); if( $subscription->is_cancelled() && $subscription->is_expired() ) { $subscription->destroy(); } } } } add_action(…Continue reading

Custom price for logged-in user role

/** * Change the payment field value based on user role. * * @param array $properties The field properties. * @param array $field The field settings. * @param array $form_data The form data. * * @return array */ add_filter( ‘wpforms_field_properties’,…Continue reading

Address field – make State field optional

add_filter( ‘wpforms_field_properties’, ‘custom_address_state_optional’, 10, 3 ); function custom_address_state_optional( $properties, $field, $form_data ) { // Check if the field is an Address field. if ( ‘address’ === $field[‘type’] ) { // Set the ‘required’ property of the ‘state’ subfield to false.…Continue reading