Remove item in Checkout

that function is deprecated, use wc_get_cart_remove_url( $cart_item_key ) instead if (is_checkout()) { $product_name .= apply_filters(‘woocommerce_cart_item_remove_link’, sprintf( ‘<a href=”%s” rel=”nofollow” class=”remove” style=”float:left;”>&times;</a>’, esc_url(wc_get_cart_remove_url($cart_item_key)), __(‘Remove this item’, ‘woocommerce’), esc_attr($cart_item[‘product_id’]), esc_attr($cart_item[‘data’]->get_sku()) ), $cart_item_key); return $product_name; }

wp_enqueue_scripts

In a link element ids WP add -css, so you need to remove it. May be this will help: function remove_font_awesome() { wp_dequeue_style(‘geowidget-4.5-css’); // not geowidget-4.5-css-css } add_action (‘wp_enqueue_scripts’, ‘remove_font_awesome’, 9999); add_action( ‘wp_head’, ‘remove_font_awesome’, 9999 );

Compare $_POST returned values with term array

Just check if $_POST contains key with id of correstponding term. if (isset($_POST[‘recvid’][$term->term_id])) { However, I would not loop through all the terms. get_terms function has corresponding option. So, to receive all posted ids, you would do this (also note, that first parameter may be a string, no need for an array): $brands = get_terms(‘recipebrands’, … Read more

preg_replace regex problem

I finally got it figured out. In order to see the content that I was trying to edit, I turned on debugging in wp-config.php: define(‘WP_DEBUG’, true); // set true if ( WP_DEBUG ) { define(‘WP_DEBUG_LOG’, ‘../logs/debug.log’ ); define(‘WP_DEBUG_DISPLAY’, false); // don’t display errors on pages @ini_set( ‘display_errors’, 0 ); } Then, in the function that … Read more

How do I add custom HTML to the content of an archive page’s posts?

Try changing the priority, there could be other filters being applied afterwards, i.e: add_filter( ‘the_content’, ‘eri_course_archive_content_filter’, 999 ); If that doesn’t work, check that the_content() is actually being called in your archive template, because for example: echo get_the_content(); will not apply any filters set on the_content

What is the alternative code to if (isset ($_POST) && !empty ($_POST) to avoid warnings?

filter_input is the proper way to go. If it doesn’t return anything valid, it will return null: $myvar = filter_input( INPUT_POST, ‘something’, FILTER_SANITIZE_STRING ); if ( empty( $myvar ) ) { // Do whatever you would have done for ! isset( $_POST[‘something’] ) } // Use $myvar filter_input won’t throw any notices if the requested … Read more