is_single()
is intend to work with post types, not categories.
To check for category you should use is_category('programming')
.
Note that is_category
works on category archives, not on single view.
So, if you want to check in the current is a single view and has the category ‘programming’ you need the has_term
tag:
if( is_single() && has_term('programming', 'category', get_queried_object()) ) {
include_once ('TEMPLATEPATH/get-messages.php');
exit();
}
See is_single, is_category and has_term on Codex.
Also have a look on how conditional tags works in WP.
Related Posts:
- Create custom page templates with plugins?
- How to Display Product specific to a category with WooCommerce Plugin? [closed]
- How can I allow commas in tag names?
- Is there a WordPress plugin that registers a plugin file as a custom page template?
- Get the category from an ID of a product?
- Is it possible to stop selected plugins from loading on certain template pages?
- Ways to have multiple front-page.php templates that can be swapped out?
- Way to force media uploader use custom image size
- Add Archive Page Template via Plugin
- Restrict individual category combinations
- Restrict access and display for categories
- Qtranslate displays empty categories with get_categories()
- Plugin for changing a post’s category based on it’s post date?
- Plugin to set all Posts in a certain Category to a certain Post Format
- Woocommerce category description as subtitle
- Why am I sometimes getting a 404 error when I try to update a page with Elementor?
- Get subcategories with JSON API plugin
- How to display a category list in a mediawiki like way?
- Template plugin for blog posts? [closed]
- Is it possible to upload a template file to a directory that can be used by all themes?
- How to show custom static content at top of each category page?
- How to use get_categories() with Event Organiser plugin
- Display posts by alphabetical order
- How to display the category name in the tab and post inside the tab in WordPress?
- Adding custom post category to categories widget
- Custom Post Type with Sequence ID
- WordPress default post categories meta box widget
- How to display category list with category featured image
- Getting the same post on my related post
- Precheck fields when I add a new post
- What plugin would make this happen? If is the theme
- automatically set random featured image by category in wordpress on post
- how can I edit the HTML of yith ajax product filter
- Unset plugins on front-end belonging to specific category
- WordPress Product Detail and catalog
- WordPress Categories as a Grid
- how do i fixe Page Builder on a custom page?
- Trying to remove a couple categories from shop page
- How to allow editors to only edit certain categories?
- Plugin json page
- Category as Subdomain for One WP Install
- Taxonomy Category Icon on index page
- Woocommerce categories displayed on every category and shopping page
- woocommerce product search based only title
- Ajax Load More on Hierarchical Categories
- How to use custom footer template in a site-plugin?
- Sub Categories in drop down menu
- How can I display a list of only categories which are marked as ‘featured’ in the backend?
- Passing variable from template file to the plugin file
- How to differently style pages that display posts of different category in WordPress?
- Related post based on 2 categories
- View more posts of a sub-category
- How to insert category name above post title in a featured pages plugin?
- Custom Page Templates for a complex application – code must sit in a plugin and not the Theme
- trying to create simple plugin to filter categories from all authors
- Displaying saved category checked in a plugin?
- WordPress Categories from Plugin
- Show all posts of all categories but excluding a category on custom blog page with pagination of my theme
- Showpost and last
- Is it possible to setup Category wise Subsciption?
- How to use categories in the URL with Advanced Custom Fields?
- Filter EVERY category link with my plugin
- Category archive in menu
- CSV file header
- Find And Add Category to Posts
- Retrieve post thumbnails
- Synch Custom Post Types (and Custom Fields, Cats, etc.) Between WordPress Sites
- Pagination in category
- How to add character to content of post?
- Editing “Kahi’s Highlight Used Categories” plugin code – highlighting parent and child category in post page
- single.php fires more than once after clicking on any post to view with different post id each time
- How can I add the custom taxonomy categories to the posts and pages?
- Twitter List Tweets and Delicious Links as Posts
- Display static pages instead of category, in code
- WordPress “Categories to tag converter” not working on imported Blogger posts
- wp_insert_post_data filter to set category
- What happened to WP No Category Base?
- 404 not found problem with URL rewrite custom category
- Is there a way to combine categories and their hierarchy into the admin listing page?
- Automatically set posts to NoIndex depending on category?
- Sort Reviews/Ratings by date on Woocommerce
- Save post to category with gravity forms (post_data) [closed]
- How to create a page template using custom plugin
- Make a Custom template for a specific category in wordpress
- formatting the way posts show up
- woocommerce retriving category name as div class?
- query_vars in plugin when using custom permalinks
- How to pre-set WordPress settings for specific posts?
- hide particular category post from front page only [closed]
- How to make horizontal scrolling menu [closed]
- Create WordPress category dynamically
- Can i have limit posts on a specific category and automatically remove older ones?
- Resources for building a custom event page template
- Categories not showing when all of the posts are private
- How to add portfolio category post count in main navigation menu?
- How to provide page_template path in custom plugin using WordPress
- Need a Category List for the category slug
- How can I disable links for categories but keep showing them on my blog in an Elementor Template?
- Page not found when I click anything on my website
- How to check if the post exists in any of the categories?