Remove my custom filter after add not working
-
My homepage site URL was like this: example.com and example.com/en/ then i want my homepage always have /en/ so i add this code to my function.php but after 1 month my website lost icon when i search in google.
function filter_pll_check_canonical_url( $redirect_url, $language ) { if (is_front_page() && !str_contains($redirect_url,'/en/') && !str_contains($redirect_url,'/vi/') || is_home() && !str_contains($redirect_url,'/en/') && !str_contains($redirect_url,'/vi/')){ $redirect_url = $redirect_url . 'en/'; } return $redirect_url; } add_filter( 'pll_check_canonical_url', 'filter_pll_check_canonical_url', 10, 2 );
I think because i was redirect my homepage to example.com/en/ so google can’t read my homepage so i was delete this code but it still redirect even i try to remove_filter like this.
add_action('init','wpse163434_init'); function wpse163434_init() { remove_filter('pll_check_canonical_url','filter_pll_check_canonical_url', 99); } add_action( 'init', 'se334421_remove_plugin_filter' ); function se334421_remove_plugin_filter() { remove_filter( 'pll_check_canonical_url', 'PLL_Frontend_Translate_Slugs::filter_pll_check_canonical_url', 10 ); }
So what i need to do to google can read my logo icon or my homepage rollback to example.com no redirect to example.com/en/ anymore.
- The topic ‘Remove my custom filter after add not working’ is closed to new replies.