DREAM CODE REPEAT

WordPress:

Remove anonymous filters and actions:

// change checkout and tours product selection
function remove_woocommerce_before_add_to_cart_button() {
    remove_anonymous_object_filter(
        'woocommerce_before_add_to_cart_button',
        'WooTour_Booking',
        'html_custom_field'
    );
}
add_action( 'wp_loaded', 'remove_woocommerce_before_add_to_cart_button', 1000 );

if ( ! function_exists( 'remove_anonymous_object_filter' ) ) {
    /**
     * Remove an anonymous object filter.
     *
     * @param  string $tag    Hook name.
     * @param  string $class  Class name
     * @param  string $method Method name
     * @return void
     */
    function remove_anonymous_object_filter( $tag, $class, $method ) {
        global $wp_filter;

        $filters = $wp_filter[ $tag ];
        if ( empty ( $filters ) ) {
            return;
        }

        foreach ( $filters as $priority => $filter ) {
            foreach ( $filter as $identifier => $function ) {
                if ( is_array( $function)
                    and is_a( $function['function'][0], $class )
                    and $method === $function['function'][1]
                ) {
                    remove_filter(
                        $tag,
                        array ( $function['function'][0], $method ),
                        $priority
                    );
                }
            }
        }
    }
}

Disable on mobile or desktop plugins/actions:

if (!wp_is_mobile()) {
add_action( ‘woocommerce_before_single_product_summary’, ‘woocommerce_show_product_images’, 20 );
remove_action( ‘woocommerce_before_single_product_summary’, ‘wooswipe_woocommerce_show_product_thumbnails’, 20 );
}

Style DIVI blogposts

https://www.elegantthemes.com/blog/divi-resources/how-to-add-custom-templates-and-design-to-divis-blog-post-formats-part-2-of-3

Update links to images

update wp_6_posts
set
post_content = REPLACE( post_content, ‘wp-content/uploads/2016’, ‘wp-content/uploads/sites/6/2016’ )
where post_content like ‘%wp-content/uploads/2016%’

update wp_6_posts
set
post_content = REPLACE( post_content, ‘wp-content/uploads/sites/24’, ‘wp-content/uploads/sites/6’ )
where post_content like ‘%wp-content/uploads/sites/24%’

update wp_6_postmeta
set
meta_value = REPLACE(meta_value, ‘wp-content/uploads/sites/24’, ‘wp-content/uploads/sites/6’ )
where meta_value like ‘%wp-content/uploads/sites/24%’

update wp_6_postmeta
set
meta_value = REPLACE(meta_value, ‘wp-content/uploads/2015’, ‘wp-content/uploads/sites/6/2015’ )
where meta_value like ‘%wp-content/uploads/2015%’

/wp-content/uploads/sites/7/2017/08/makingwavesnl.svg