• Resolved Marie-Aude

    (@marie-aude)


    Hello

    I’d like to know what are the hooks or filters available to modify meta and inclusion in sitemap at a term level ?

    Thank you for your answer ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @marie-aude,

    I’m afraid we don’t have a documentation that we could share regarding this at the moment; however, I’m checking with our developer regarding this and will get back once we get further update asap.

    Kind Regards,
    Nithin

    Thread Starter Marie-Aude

    (@marie-aude)

    Thank you. I already asked the question to the support on your website and they directed me here.
    Kind regards

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @marie-aude,

    We would like to have a bit more information, when you meant by “modify”, could we know the exact workflow you are looking to achieve?

    That’s whether you are looking to exclude taxonomy terms from sitemaps, right? For terms, you can check whether the following hook might help or not:
    wds_terms_sitemap_include_term_ids

    If the above doesn’t help much, please do explain further about the workflow you are looking to implement, so that we could check and assist further.

    Looking forward to your response.

    Kind Regards,
    Nithin

    Thread Starter Marie-Aude

    (@marie-aude)

    Hi @nithin

    Yes I would like to exclude an array of terms ID from the sitemap.

    My process is to have all taxonomies marked as “index” and “include in sitemap”, and then apply some logic to filter some terms in noindex (using wds-taxonomy-meta-wds_noindex).

    And I would like to exclude these same terms from the sitemap.

    I had a look at the hook, and it seems it includes the array of terms provided. Which is exactly the opposite of my process. Or did I misunderstand ?

    Kind regards

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @marie-aude,

    We are checking with our developer regarding this, and we’ll get back once we have more insights on this as soon as possible.

    Kind Regards,
    Nebu John

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @marie-aude,

    Could you please check the following example snippet and see whether it fits your needs:

    <?php
    
    add_filter( 'wds_terms_sitemap_include_term_ids', 'wpmudev_exclude_terms_ids', 9999, 2 );
    function wpmudev_exclude_terms_ids( $include_ids, $taxonomies ){
    	$term_query = new Smartcrawl_Sitemap_Terms_Query();
    	$types = array();
    	$types = empty( $types ) ? $term_query->get_supported_types() : array( $types );
    	$term_query = new WP_Term_Query( array(
    		'taxonomy'	=> $types,
    		'fields'	=> 'ids',
    		'exclude'	=> array(1,155)
    	) );
    	
    	$term_ids = $term_query->get_terms();
    	if ( empty( $term_ids ) ) {
    		$term_ids = array( - 1 );
    	}
    	$include_ids = empty( $include_ids ) || ! is_array( $include_ids )
    		? array()
    		: $include_ids;
    	return array_merge( $include_ids, $term_ids );
    }

    Where the following line is where the terms are added:
    'exclude' => array(1,155)

    You’ll need to replace the array with your term IDs ie if the term IDs are 1, 2, 3 then the above line would be:

    'exclude' => array(1,2,3)
    `

    You can implement the above code as a mu-plugins. Please check this link on how to implement the above code as a mu-plugins:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Kind Regards,
    Nithin

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @marie-aude,

    Since we haven’t heard from you for a while. I’ll mark this thread as resolved for now. Please feel free to re-open the thread if you need further assistance.

    Best Regards
    Nithin

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hooks and filters available’ is closed to new replies.