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
- category id (term_id) in url instead of slug
- exclude certain categories from the list at the end of the blog post
- Exclude category when displaying all categories assigned to a post
- Exclude the Newest Recent Post from their Category After New post Publish old post should be in their category at Home Page
- Printing direct descendants of a category with WP_Query
- Category slug in in loop always the same?
- Create Cross Promoting Categories in WordPress Using ‘pre_get_posts’
- Pluck single parent category from get_the_category
- wp_get_archive for category returning different URLs on different but similar sites
- get_category_parents displays an empty category
- How to enable admins/editors to set a featured image for specific category?
- Category count but only if category has at least one post
- Why is my post categories not displaying?
- Removing short versions of category archive URL
- Custom Category Page Not Working [duplicate]
- Pages, Categories, and working with someone else’s code
- Placement of categories
- Right way for setting categories
- altering theme – content generated by PAGES not PORTFOLIO