{"id":7887,"date":"2021-02-19T17:06:27","date_gmt":"2021-02-19T16:06:27","guid":{"rendered":"https:\/\/www.welaunch.io\/fr\/?p=7887"},"modified":"2024-05-15T11:37:49","modified_gmt":"2024-05-15T09:37:49","slug":"no-index-hidden-woocommerce-products-from-yoast","status":"publish","type":"post","link":"https:\/\/www.welaunch.io\/fr\/2021\/02\/no-index-hidden-woocommerce-products-from-yoast\/","title":{"rendered":"Pas d&#8217;indexation des produits WooCommerce cach\u00e9s par Yoast"},"content":{"rendered":"<p>Les produits WooCommerce avec le statut de visibilit\u00e9 cach\u00e9 (exclus du catalogue) sont toujours index\u00e9s par l&#8217;outil Yoast SEO. POUR les supprimer des Sitemaps g\u00e9n\u00e9r\u00e9es automatiquement et d\u00e9finir le statut de l&#8217;index \u00e0 &#8220;noindex, nofollow&#8221; ajoutez les 2 fonctions suivantes \u00e0 vos fonctions.phpadd_filter( &#8216;wpseo_sitemap_entry&#8217;, &#8216;we_remove_hidden_products&#8217;, 99, 3) ;function we_remove_hidden_products($url, $type, $post) {si($post->post_type == &#8216;product&#8217; &#038;&#038; is_object_in_term( $post->ID, &#8216;product_visibility&#8217;, &#8216;exclude-from-catalog&#8217;)){retourner &#8221; ;}retourner $url ;}add_filter(&#8216;wpseo_robots&#8217;, &#8216;we_noindex_hidden_products&#8217;, 10, 2) ;function we_noindex_hidden_products($robots, $indexable) {si(!isset($indexable->model)) {return $robots ;}si(!isset($indexable->model->object_id)) {return $robots ;}si(is_object_in_term( $indexable->model->object_id, &#8216;product_visibility&#8217;, &#8216;exclude-from-catalog&#8217;)){$robots=&#8217;noindex, nofollow&#8217; ;}return $robots ;}<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Les produits WooCommerce avec le statut de visibilit\u00e9 cach\u00e9 (exclus du catalogue) sont toujours index\u00e9s par l&#8217;outil Yoast SEO. POUR les supprimer des Sitemaps g\u00e9n\u00e9r\u00e9es automatiquement et d\u00e9finir le statut de l&#8217;index \u00e0 &#8220;noindex, nofollow&#8221; ajoutez les 2 fonctions suivantes \u00e0 vos fonctions.phpadd_filter( &#8216;wpseo_sitemap_entry&#8217;, &#8216;we_remove_hidden_products&#8217;, 99, 3) ;function we_remove_hidden_products($url, $type, $post) {si($post->post_type == &#8216;product&#8217; &#038;&#038;&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[4],"tags":[],"class_list":["post-7887","post","type-post","status-publish","format-standard","hentry","category-woocommerce"],"_links":{"self":[{"href":"https:\/\/www.welaunch.io\/fr\/wp-json\/wp\/v2\/posts\/7887","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.welaunch.io\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.welaunch.io\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.welaunch.io\/fr\/wp-json\/wp\/v2\/comments?post=7887"}],"version-history":[{"count":2,"href":"https:\/\/www.welaunch.io\/fr\/wp-json\/wp\/v2\/posts\/7887\/revisions"}],"predecessor-version":[{"id":8977,"href":"https:\/\/www.welaunch.io\/fr\/wp-json\/wp\/v2\/posts\/7887\/revisions\/8977"}],"wp:attachment":[{"href":"https:\/\/www.welaunch.io\/fr\/wp-json\/wp\/v2\/media?parent=7887"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.welaunch.io\/fr\/wp-json\/wp\/v2\/categories?post=7887"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.welaunch.io\/fr\/wp-json\/wp\/v2\/tags?post=7887"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}