admin管理员组文章数量:1122826
I am new to php and Wordpress. I currently have custom type named "helppost" that should hold Help posts. It has three categories:
- 'Getting Started' with slug "getting-started"
- 'Safety and Privacy' with slug "safety-and-privacy"
- 'Trouble Shooting' with slug "trouble-shooting"
I have an archive page that shows help posts for each of these 3 help categories. I have a hook that needs to perform a certain business logic when I am on this archive.
I am currently using Elementor Pro.
How do I know if I the user is currently looking at the archive of these help categories? I looked at many functions but nothing seemed to work.
is_post_type_archive() did not work is_archive() did return 1 but I need to know that if the archive belongs to one of the categories. I don't want the archive of a blog post for example.
Please let me know which function I should call and parameters I should pass it as i am new to Wordpress and php.
Thanks
I am new to php and Wordpress. I currently have custom type named "helppost" that should hold Help posts. It has three categories:
- 'Getting Started' with slug "getting-started"
- 'Safety and Privacy' with slug "safety-and-privacy"
- 'Trouble Shooting' with slug "trouble-shooting"
I have an archive page that shows help posts for each of these 3 help categories. I have a hook that needs to perform a certain business logic when I am on this archive.
I am currently using Elementor Pro.
How do I know if I the user is currently looking at the archive of these help categories? I looked at many functions but nothing seemed to work.
is_post_type_archive() did not work is_archive() did return 1 but I need to know that if the archive belongs to one of the categories. I don't want the archive of a blog post for example.
Please let me know which function I should call and parameters I should pass it as i am new to Wordpress and php.
Thanks
Share Improve this question edited May 7, 2024 at 19:38 Aimn Blbol 1033 bronze badges asked May 7, 2024 at 3:26 AimnAimn 112 bronze badges1 Answer
Reset to default 1You could consider using is_tax
:
Determines whether the query is for an existing custom taxonomy archive page.
You can pass in the taxonomy slug to test if the current taxonomy archive page is for your taxonomy:
if ( is_tax( 'my_taxonomy' ) ) {
本文标签: pluginsHow do I know if an archive correspond to a custom post type taxonomy
版权声明:本文标题:plugins - How do I know if an archive correspond to a custom post type taxonomy? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736307891a1933468.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论