WooCommerce – Display variation custom field value [closed]

Ok, I’ve managed to solve this. This is how i finally created variations custom field: add_action( ‘woocommerce_product_after_variable_attributes’, ‘variation_settings_fields’, 10, 3 ); add_action( ‘woocommerce_save_product_variation’, ‘save_variation_settings_fields’, 10, 2 ); function variation_settings_fields( $loop, $variation_data, $variation ) { woocommerce_wp_text_input( array( ‘id’ => ‘price_1_50[‘ . $variation->ID . ‘]’, ‘class’ => ‘price_1_50’, ‘type’ => ‘text’, ‘label’ => __( ‘Price | Product … Read more

Properly applying nonce to a form using AJAX

You just need to send the nonce along with your AJAX data: $.ajax({ type: ‘POST’, url : profile_edit.ajaxurl, data: $(‘#profile_update’).serialize() + ‘&my_nonce=” + profile_edit.nonce + “&action=update_profile_post’, // don’t forget the action name! }); Alternatively, since you’re using jQuery’s serialize() function, you could just add the nonce directly in the form: <?php wp_nonce_field( ‘update_profile_validation’, ‘my_nonce’ ); … Read more

Set user loggin status?

Use wp_signon(). Ex: $creds = array(); $creds[‘user_login’] = ‘example’; $creds[‘user_password’] = ‘plaintextpw’; $creds[‘remember’] = true; $user = wp_signon( $creds, false ); if ( is_wp_error($user) ) echo $user->get_error_message(); See Codex for more details about wp_signon().

WordPress change author email notify message?

$comment_id can be passed as second parameter to your function. Modify you add_filter: add_filter(‘comment_notification_text’, ‘myfunction’, 10, 2); Then get $comment and $post from $comment_id: function myfunction( $notify_message, $comment_id ) { $comment = get_comment( $comment_id ); $post = get_post($comment->comment_post_ID);

wp_title() handling of author page

I see my name in the title when viewing author pages. wp_title() runs this code during execution.. // If there’s an author if ( is_author() ) { $author = get_queried_object(); $title = $author->display_name; } Perhaps your author(s) don’t have a display name set? Additionally be sure to try disabling plugins that may be hooking a … Read more