Category: Disable
Disable Tasty Pins on the homepage and the blog page
add_filter( ‘the_content’, function ( $content ) { // Return early if it isn’t the home page or the blog page. if ( ! is_home() && ! is_front_page() ) { return $content; } return str_replace( ‘Continue reading
Remove “No Reviews” label if there are not reviews in Tasty Recipes
function tasty_recipes_remove_no_reviews_label( $content ) { global $post; if ( ! $post ) { return $content; } $post_id = $post->ID; $has_recipe = \Tasty_Recipes::has_recipe( $post_id ); if ( ! $has_recipe ) { return $content; } $recipe_id = \Tasty_Recipes::get_recipe_ids_for_post( $post_id )[0]; $recipe =…Continue reading
Google tag
Disable Smooth Scrolling in Tasty Recipes
add_filter( ‘tasty_recipes_smooth_scroll’, ‘__return_false’ );Continue reading
Blocking search from bots
add_action(‘pre_get_posts’, function($query) { if ($query->is_search() && !is_admin()) { $referer = wp_get_referer(); $site_url = get_site_url(); if (empty($referer) || strpos($referer, $site_url) !== 0) { // Block the request early to save CPU header(‘HTTP/1.1 403 Forbidden’); exit; } } });Continue reading
WordPress Post Views Counter Function
function wpb_set_post_views($postID) { $count_key = ‘wpb_post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ $count = 0; delete_post_meta($postID, $count_key); add_post_meta($postID, $count_key, ‘0’); }else{ $count++; update_post_meta($postID, $count_key, $count); } } //Get rid of prefetching to keep the count accurate remove_action( ‘wp_head’, ‘adjacent_posts_rel_link_wp_head’, 10,…Continue reading
Disable Inspector Tabs
add_filter( ‘block_editor_settings_all’, function ( $settings ) { if ( ! isset( $settings[‘blockInspectorTabs’] ) ) { $settings[‘blockInspectorTabs’] = array(); } $settings[‘blockInspectorTabs’] = array_merge( $settings[ ‘blockInspectorTabs’ ], array( ‘default’ => false, // Disables for all blocks. ), ); return $settings; } );Continue reading
Meta Pixel Code
Disable filter added by the Caddy plugin that hides WooCommerce shipping rates
/** * Removes the ‘woocommerce_package_rates’ filter added by the Caddy plugin. * * Removes the filter that hides other WooCommerce shipping rates * when free shipping is available, allowing all rates to show. * * @author Mike Valera * @plugin…Continue reading