change search url

function wpb_change_search_url() { if ( is_search() && ! empty( $_GET[‘s’] ) ) { wp_redirect( home_url( “/search/” ) . urlencode( get_query_var( ‘s’ ) ) ); exit(); } } add_action( ‘template_redirect’, ‘wpb_change_search_url’ );Continue reading

Preload First Post Image

function preload_first_content_image() { if (is_single()) { $post = get_post(); if ($post) { // Get post content $content = $post->post_content; // Find first image in the content preg_match_all(‘//i’, $content, $matches); if (!empty($matches[1])) { $first_image = $matches[1][0]; echo ‘‘; } } }…Continue reading

Remove HealthAndBeautyBusiness Schema

add_filter(‘aioseo_schema_output’, ‘aioseo_remove_health_and_beauty_business_schema’); function aioseo_remove_health_and_beauty_business_schema($graphs) { foreach ($graphs as $index => $value) { if (isset($value[‘@type’]) && $value[‘@type’] === ‘HealthAndBeautyBusiness’) { unset($graphs[$index]); } } return $graphs; }Continue reading

Elementor Form Autofill

/** * Add autocomplete setting to form fields. */ add_action( ‘elementor/element/form/section_form_fields/before_section_end’, function( \Elementor\Widget_Base $widget ) { $elementor = \ElementorPro\Plugin::elementor(); $control_data = $elementor->controls_manager->get_control_from_stack( $widget->get_unique_name(), ‘form_fields’ ); if( is_wp_error( $control_data ) ) { return; } $control_data[‘fields’] = $control_data[‘fields’] + [ ‘namespace_autocomplete’ =>…Continue reading

Modify WooCommerce Coupon Message

add_filter( ‘woocommerce_coupon_message’, ‘modify_woocommerce_coupon_message’, 10, 3 ); function modify_woocommerce_coupon_message( $msg, $msg_code, $coupon ) { if( $msg === __( ‘Coupon code applied successfully.’, ‘woocommerce’ ) ) { $msg = sprintf( __( “You are getting $%s discounts.”, “woocommerce” ), ‘‘ . $coupon->get_amount() .…Continue reading