Posts

Remove upsell product with main product From Cart in woocommerce

 add_action( 'woocommerce_cart_item_removed', function( $removed_cart_item_key, $cart){ //wp_mail( 'navototest@gmail.com', 'test', $removed_cart_item_key ); $cart = WC()->instance()->cart; $line_item = $cart->removed_cart_contents[ $removed_cart_item_key ];     $product_id = $line_item[ 'product_id' ]; wp_mail( 'navototest@gmail.com', 'test'.$product_id, $product_id ); //$counter = WC()->cart->get_cart_contents_count(); // for($i = 1; $i <= $counter; $i++){ // $cart_item_breakfast_id = $cart->find_product_in_cart($product_id); // wp_mail( 'navototest@gmail.com', 'upsell'.$cart_item_breakfast_id, $cart_item_breakfast_id ); //             if($cart_item_breakfast_id){ //                 $cart->set_quantity($cart_item_breakfast_id, 0);                               ...

Wordpress Mail Function

   $to = 'navototest@gmail.com'; $subject = 'The subject'; $body = 'The email body content'; $headers = array(      'From: Meirav Group <meiravgilboam@gilboam.co.il>',     'Content-Type: text/html; charset=UTF-8'     );   echo wp_mail( $to, $subject, $body, $headers ); die();

Disable Update Theme and plugin Wordpress

  define( 'WP_AUTO_UPDATE_CORE', false ); add_filter( 'auto_update_plugin', '__return_false' ); add_filter( 'auto_update_theme', '__return_false' );

Get Category, Child Category and category Image Word Press

 $args = array(         'hide_empty'        => true,         'parent'        => '0',         'meta_key'        => 'exwoofood_menu_order',         'orderby'        => 'meta_value_num',     ); $exwf_mngr = get_terms('product_cat', $args); foreach ($exwf_mngr as $key => $value) {     $args = array(     'hide_empty'   => true,     'parent' => $value->term_id );    ///  for child cat $termss = get_terms( 'product_cat', $args ); $termscat_chils = ''; foreach ($termss as $key => $tsvalue) {  $termscat_chils .=  $tsvalue->name.','; } $thumbnail_id = get_term_meta( $value->term_id, 'thumbnail_id', true ); if($thumbnail_id!=''){ // get the medium-sized image url $image = wp_get_attachment_image_src( $thumbnail_id, 'full' ); // O...

Disable Guttenburg editor wordpress

You need to put these code in your functions.php  // Disable Gutenberg From the back end. add_filter ( 'use_block_editor_for_post', '__return_false' ); // Disable Gutenberg From  widgets. add_filter ( 'use_widgets_blog_editor', '__return_false' ); add_action ( 'wp_enqueue_scripts', function() { // Remove CSS From  the front end. wp_dequeue_style ( 'wp-block-library' ); // Remove Gutenberg From theme. wp_dequeue_style ( 'wp-block-library-theme' ); // Remove inline global CSS From  the front end. wp_dequeue_style ( 'global-styles' ); }, 20 );

Create Custom Post Type wordpress

 function custom_post_type() {     // Set UI labels for Custom Post Type     $labels = [         'name' => _x('Deals', 'Post Type General Name', 'twentytwenty'),         'singular_name' => _x('Deal', 'Post Type Singular Name', 'twentytwenty'),         'menu_name' => __('Deals', 'twentytwenty'),         'parent_item_colon' => __('Parent Deal', 'twentytwenty'),         'all_items' => __('All Deals', 'twentytwenty'),         'view_item' => __('View Deal', 'twentytwenty'),         'add_new_item' => __('Add New Deal', 'twentytwenty'),         'add_new' => __('Add New', 'twentytwenty'),         'edit_item' => __('Edit Deal', 'twentytwenty'),         'update_item' => __('Update Deal', 'twentytwenty'),         ...

Remove css or js version wordpress

 // remove wp version number from scripts and styles function remove_css_js_version( $src ) {     if( strpos( $src, '?ver=' ) )         $src = remove_query_arg( 'ver', $src );     return $src; } add_filter( 'style_loader_src', 'remove_css_js_version', 9999 ); add_filter( 'script_loader_src', 'remove_css_js_version', 9999 );