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.


1 Answer 1


You 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' ) ) {
  • Thanks for your help. This actually worked is_tax( 'helpcat', 'getting-started' ). But what if I have many subcategories under the helpcat? I don't want to do many checks. Isn't there a way to say for any helpcat subcategory? This did not work is_tax( 'helpcat')
    – Aimn Blbol
    Commented May 8 at 10:32
  • 1
    Yes, you can call is_tax() without the second parameter, is_tax( 'helpcat' ). This would return true for any helpcat taxonomy term post loop.
    – Wongjn
    Commented May 8 at 10:46
  • You are a 100% correct. that did solve my problem. But how do I tell WP not to paginate an archive page in the first place?
    – Aimn Blbol
    Commented May 8 at 10:59
  • You could consider setting the posts_per_page query var to -1 in the pre_get_posts hook.
    – Wongjn
    Commented May 8 at 11:32
  • I trie that but now any page number i place in the query will not give me 404. For example /page/1000000 will give me the page and not 404!!
    – Aimn Blbol
    Commented May 8 at 11:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.