• Resolved moyoasks

    (@fredolopez)


    I was looking for a way to exclude a taxonomy within this plugin’s setting’s page with no avail. I don’t know if I am missing something. Specifically I want to exclude the vendor_shop taxonomy. At the moment the plugin is redirecting to a filtered page created on the fly with the products of a vendor’s shop and not landing a the vendor’s shop.

    This is done because I have checked the option “Force the redirection of all the archive pages for the products-related taxonomies (such as categories, tags, brands) to the shop page with the corresponding taxonomy filter applied.”

    Is there a way to exclude these vendor’s pages from these filters?

    Thank you in advanced for your prompt response.

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author annastaa

    (@annastaa)

    Hello fredolopez,

    Unfortunately, there is no built-in option to exclude taxonomies when redirecting products taxonomy archives. However, if you have a child theme installed, or some other way to add php code to your site, you could try to add this (to the functions.php of your theme or whatever other file works for you):

    if( class_exists( 'A_W_F' ) && ! empty( A_W_F::$front ) ) {
    	remove_action( 'template_redirect', array( A_W_F::$front, 'redirect_archives' ), 20 );
    	add_action( 'template_redirect', 'annasta_filters_redirect_archives', 20 );
    }
    
    if ( ! function_exists( 'annasta_filters_redirect_archives' ) ) {
    	
    	function annasta_filters_redirect_archives() {
    		if( A_W_F::$front->is_archive && 'yes' === get_option( 'awf_redirect_archives', 'no' ) ) {
    			
    			if( 'dc_vendor_shop' !== A_W_F::$front->is_archive ) { // exclude the needed taxonomy(ies) here
    				unset( A_W_F::$front->url_query['archive-filter'] );
    				A_W_F::$front->url_query[A_W_F::$front->vars->tax[A_W_F::$front->is_archive]] = implode( ',', A_W_F::$front->query->tax[A_W_F::$front->is_archive] );
    				wp_redirect( add_query_arg( A_W_F::$front->url_query, A_W_F::$front->shop_url ) );
    				die;
    			}
    			
    		}
    	}
    }

    Hope this helps! If you get to use the above code, please let me know if it resolves your issue.

    Thread Starter moyoasks

    (@fredolopez)

    Thank you much for your prompt response. I will try the code you sent above and let you know how it goes.

    Best,

    Plugin Author annastaa

    (@annastaa)

    Good luck, we will appreciate it if you can report back on the result of your tests!

    Thread Starter moyoasks

    (@fredolopez)

    Hello Annastaa team,

    The snippet worked as intended. Thank you very much for your support.

    Best regards!

    Plugin Author annastaa

    (@annastaa)

    We are glad that the snippet helped, thank you for the feedback!

    I will go ahead and mark this as resolved. You are welcome to open a new thread if you have any further questions!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to exclude a specific taxonomy’ is closed to new replies.