No hay índice oculto de productos WooCommerce de Yoast

Los productos de WooCommerce con el estado de visibilidad oculto (excluidos del catálogo) siguen siendo indexados por la herramienta Yoast SEO. Para eliminarlos de los sitemaps generados automáticamente y establecer el estado del índice en “noindex, nofollow” añada las siguientes 2 funciones a sus funciones.phpadd_filter( ‘wpseo_sitemap_entry’, ‘we_remove_hidden_products’, 99, 3);function we_remove_hidden_products($url, $type, $post) {si($post->post_type == ‘product’ && is_object_in_term( $post->ID, ‘product_visibility’, ‘exclude-from-catalog’)){devuelve ”;}devolver $url;}add_filter(‘wpseo_robots’, ‘we_noindex_hidden_products’, 10, 2);function we_noindex_hidden_products($robots, $indexable) {si(!isset($indexable->model)) {devolver $robots;}si(!isset($indexable->model->object_id)) {devolver $robots;}si(is_object_in_term( $indexable->model->object_id, ‘product_visibility’, ‘exclude-from-catalog’)){$robots=’noindex, nofollow’;}devolver $robots;}

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Close Popup

We use cookies to give you the best online experience. By agreeing you accept the use of cookies in accordance with our cookie policy.

Close Popup
Privacy Settings saved!
Privacy Settings

When you visit any web site, it may store or retrieve information on your browser, mostly in the form of cookies. Control your personal Cookie Services here.

These cookies are necessary for the website to function and cannot be switched off in our systems.

Technical Cookies
In order to use this website we use the following technically required cookies
  • wordpress_test_cookie
  • wordpress_logged_in_
  • wordpress_sec

Decline all Services
Save
Accept all Services