-
Hi Guys,
We were using the folloowing code for a site of which we noindex/nofollowed all Simple products, allowing the grouped products to be indexed ( using ALL IN ONE SEO )
Unfortunately, we’ve found that this code stopped working, most likely a result of ALL IN ONE SEO big update.
So after switching to RANK MATH on a few other sites, I’d like to do the same for this site, but does anyone have any code which can do what we need with rank math.
add_filter('wp', 'wp_dev'); function wp_dev(){ $post_id = get_the_ID(); if ('product' == get_post_type($post_id)) { $_product = wc_get_product( $post_id ); if( $_product->is_type( 'simple' ) ) { update_post_meta( $post_id, '_aioseop_noindex', 'on' ); update_post_meta( $post_id, '_aioseop_nofollow', 'off' ); update_post_meta( $post_id, '_aioseop_custom_link', 'GROUPED PRODUCT PERMALINK ?????' ); } } }So essentially, because alot of the pages are now indexed as a result of this mistake. Id like to do the following
1. Noindex all Single products
2. follow all single products
3. Set custom canonical to grouped product parent.Any help in achiving this would be much appreciated.
The ticket ‘Woocommerce Simple Product to Group product’ is closed to new replies.