Skip Navigation

[Resolved] taxonmy access

This support ticket is created 4 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by Jane 4 years, 5 months ago.

Assisted by: Shane.

Author
Posts
#1776117

I am trying to: block wordpress new sitemap from accessing custom taxonomies and the built in wordpress taxonomies.

I have custom post types that I have blocked public access to by using access. These post types have custom taxonomies that are only used on these custom post types. I recently reviewed wordpress's new sitemap and noticed that the taxonomy list are publicly available. The content is not but the list is. Is there a way to hide the taxonomy list from the sitemap ?

#1776397

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jane,

Thank you for getting in touch.

Unfortunately no this is not possible without the use of custom code. How is the sitemap being created? Maybe there is a hook that can be used to do this.

I will need to know if it's a plugin that you are using to do this and which plugin.

Thanks,
Shane

#1776527

As I said, it is the new wordpress built in sitemap and not a plugin.

This should be a feature as part of toolset access. Similar to how you can restrict access to post types by user roles. If this can't be done what is the custom code to give access to users and not guests ?

Thanks for your help.

#1777399

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2020-09-15 at 9.02.27 AM.png

Hi Jane,

Actually you can restrict the taxonomies by the user roles, if you disable the Manage Term option for the role, the user wont have access to the taxonomy. See Screenshot

This option can be found under the taxonomy tab in Access.

I was under the assumption that you would've wanted this to be done automatically. Once you set the permissions on the terms for the user roles then it should no longer appear.

Thanks,
Shane

#1777605

Hi Shane,

I'm aware of the taxonomy tab in Access, as all my settings are set to admin only. But there is no setting to restrict "Viewing" access. Which would be an ideal setting.

I have found custom coding that works from this link: https://make.wordpress.org/core/2020/07/22/new-xml-sitemaps-functionality-in-wordpress-5-5/

My only questions is: How would you change this code to add multiple different terms ? for example post_tag, category, season, events and many more.

add_filter(
    'wp_sitemaps_taxonomies',
    function( $taxonomies ) {
        unset( $taxonomies['post_tag'] );
        return $taxonomies;
    }
);
#1777619

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Jane,

Based on the usage of the unset() function. You can do it like this.

 unset( $taxonomies['post_tag'] , $taxonomies['taxonomy_slug'] );

hidden link
Please let me know if this helps.
Thanks,
Shane

#1779965

My issue is resolved now. Thank you!