As Geert pointed out, your current conditional will always be true.
An if() construct needs to be fed an expression.
You’re feeding it a valid array, so that’s true. Always.
So far this is basic PHP, regardless of whether in a WP environment or not.
As can be read in Chris_O’s comment
if ( is_category('some-cat') && is_tag('some-tag') ) {
// do something
}
will do the trick.
'some-cat'
and 'some-tag'
may be the category/tag slug, id or title.
The codex page on conditional tags explains the use of these rather well.
Related Posts:
- I need to exclude from a query a category and a few custom taxonomies
- exclude category from get_posts?
- Exclude the category from the WordPress loop
- Exclude certain category from latest updates
- How to add the category ID to admin page
- Exclude categories from Loop, queries, widgets, post navigation
- List posts by category exclude current post
- wp_list_categories exclude not working
- Excluding a category from next and previous post links
- Exclude Category From Home Page, Display Posts on It’s Own Page?
- Add category to custom post type automatically, using category slug
- Return array of categories to php function
- How to exclude categories from recent posts, recent comments & category widgets?
- Exclude a category from the filed under list only on some templates
- Listing all posts from current category on page
- Display WooCommerce product categories in a 4 columns custom menu [closed]
- On Category page, How can I get the category ID?
- Show post only if match all categories
- Dropdown category filter
- How to exclude posts from a category when using this particular format
- How to get category URL with the slug?
- Exclude category from Tag Template
- How to view WordPress’ default category IDs?
- exclude post from displaying in loop if it is in a category, but not in many categories
- I need to create a search form that will display search results from specific category
- Exclude Posts From Specific Category from Next and Previous post links
- Resort get_categories
- Query Posts Exclude Entire Category
- exclude categories from search results
- Exclude category from fucntion
- WordPress category widget only show categories with children
- Style category link depending on category ID
- How to use an array of categories as a dropdown?
- Create menu locations for each category in wordpress
- wp_list_pages() exclude category
- Exclude category from query
- Functions.php: Exclude Category from “Blog”
- Use premade array as categories in wp_query?
- Array: What is this value based on?
- How to get an array with all categories and corresponding names?
- Link To Child Category For A Post
- List a maximum of ‘x’ product categories with qty of ‘y’ in each column
- Woocommerce filter function not updating
- Edit tag_id in category pages of dashboard
- wp_list_categories not excluing multiple ids
- Need to echo category id in multi-dimensional array
- Getting Category Children
- How to get selected taxonomy or category ID if using custom walker?
- How to exclude posts from category posts count
- Exclude category from foreach loop
- Have posts that belong to multiple categories, exclude some categories from homepage
- Exclude all subcategories in the_category (post)
- Exclude categories by ID
- Check is category parent with ids from the childs – get_term_children
- Homepage custom recent news
- Exclude the category in WordPress
- How can I exclude a category from the main loop with the category name & not ID?
- User level categories
- Exclude category from drop down list form
- exclude certain categories form archive widget
- Pull in an “Include” file based on a WordPress Category ID
- How to remove an item from a custom Walker_Nav_Menu
- Exclude a category and post_type from wp_query
- How can I exclude a particular category from my WordPress Page 1 and Page 2?
- Exclude category from WP_Query args not working
- Displaying Category in sidebar post widget but not in the loop on home
- Cant get unique_array() work on get_the_category() foreach loop
- Store All Post Categories In Array
- Category menu that filters out empty categories
- Matching usermeta at registration to categories of content
- Display 1 category only with get_the_category (by ID or slug)
- Problems with explode [closed]
- Exclude Category From Home Page, Display Posts on It’s Own Page?
- How to have a category not show up in query post with page panigation?
- Customize category query in widget
- How to change category id on get_posts array
- Exclude a ‘portfolio’ custom category?
- Call function on a single page
- Excluding cateory not working on my site. how to solve this? [closed]
- Order Categories by Character Count
- how do I exclude a category foreach
- is_category() function
- Remove “Category Archives: title” at the top of a category page [duplicate]
- Display empty taxonomy terms with get_terms()
- How can I show the subcategories content on the parent category page?
- Format Brand value in Category view [closed]
- Possible to make a subdirectory that loops through a single category?
- Archives for each category on WP Multisite
- Update post title with category name after editing a category
- Automatically set default password to all posts in a specific category
- Categories showing page not found
- How to select category on if function
- Problem with different query loops (and “main loop”) on category template page!
- Copy post taxonomy?
- How to get sub-categories to display same look as there parents
- Combining these queries? (Same taxonomy term + same category as post)
- get_object_term_cache duplicate terms after update to wordpress 6
- Style post archive blog preview based on category
- How to display get_categories selected category?
- Open everything in new tab