This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.
This documentation has moved here: https://github.com/johnbillion/wp_mail
/* | |
Update the SSLVERSION for CURL to support PayPal Express moving to TLS 1.2 | |
More info: https://devblog.paypal.com/upcoming-security-changes-notice/ | |
Your server will need to be updated to a supported version of OpenSSL for this to work. | |
Add this code to your active theme's functions.php or a custom plugin. | |
*/ | |
function my_http_api_curl($handle) { |
/* | |
Uploading images is a two step process (from https://github.com/WP-API/WP-API/issues/1768#issuecomment-160540932): | |
POST the data to /wp/v2/media - this can either be as the request body, or in multipart format. This will upload the file, and give you a 201 Created response with a Location header. This header points to the post object for the attachment that has just been created. | |
PUT the post data to the endpoint returned in the Location header (which will look something like /wp/v2/media/{id}). | |
I do step 2 (PUT), if POST is a success, in myDropzone.on("success", function(file, response){} | |
*/ | |
// dropzoneWordpressRestApiForm is the configuration for the element that has an id attribute |
<?php | |
/* | |
Plugin Name: Toggle Debug | |
Description: Proof-of-concept for an admin-bar debug mode toggle. Needs some UX love. | |
*/ | |
/* | |
// In wp-config.php, wrap debug constants in a cookie conditional | |
if ( isset( $_COOKIE['wp-debug'] ) && $_COOKIE['wp-debug'] == 'on' ) { | |
define('WP_DEBUG', true); | |
} |
<?php | |
// Remove jQuery Migrate From End | |
add_filter( 'wp_default_scripts', 'remove_jquery_migrate' ); | |
function remove_jquery_migrate( &$scripts) | |
{ | |
if(!is_admin()) | |
{ | |
$scripts->remove( 'jquery'); | |
$scripts->add( 'jquery', false, array( 'jquery-core' ), '1.10.2' ); |
<?php | |
/** | |
* Add order again button in my orders actions. | |
* | |
* @param array $actions | |
* @param WC_Order $order | |
* @return array | |
*/ | |
function cs_add_order_again_to_my_orders_actions( $actions, $order ) { | |
if ( $order->has_status( 'completed' ) ) { |
add_action( 'woocommerce_cart_actions', 'move_proceed_button' ); | |
function move_proceed_button( $checkout ) { | |
echo '<a href="' . esc_url( WC()->cart->get_checkout_url() ) . '" class="checkout-button button alt wc-forward" >' . __( 'Proceed to Checkout', 'woocommerce' ) . '</a>'; | |
} |
This document lists all the situations where WordPress sends an email, along with how to filter or disable each email.
This documentation has moved here: https://github.com/johnbillion/wp_mail
<?php | |
/** | |
* Plugin Name: Postcode Shipping | |
* Description: This plugin allows you to set a flat shipping rate per country or state or postcode per Quantity/Order on WooCommerce. | |
* Version: 2.1.2 |
// Automatically grant membership at registration | |
function sv_add_membership_at_registration( $user_id ) { | |
$args = array( | |
// Enter the ID (post ID) of the plan to grant at registration | |
'plan_id' => 253, | |
'user_id' => $user_id, | |
); | |
wc_memberships_create_user_membership( $args ); | |
} | |
add_action( 'user_register', 'sv_add_membership_at_registration', 15 ); |
<?php | |
// SearchWP/Sensei compat | |
function searchwp_sensei_compat() { | |
if ( is_post_type_archive() && is_search() ) { | |
add_filter( 'searchwp_outside_main_query', '__return_true' ); | |
} | |
} | |
add_action( 'parse_query', 'searchwp_sensei_compat' ); |