I think has_category() should help you.
function info_after_post($content){
if (is_single() && ! has_category(71)) {
$content .= 'AD CODE';
}
return $content;
}
add_filter( 'the_content', 'info_after_post' );
Related Posts:
- Display random categories on the front page (Finding and Editing Theme Functions)
- How to add classes to images based on their categories?
- current_cat_ancestor Alternatives
- Add body class of category parent
- Changing a function in function.php to a shortcode – for listing categories of only a certain post type
- Php string not working in WordPress Functions.php (trying to fetch 1st category for each blog that post appears in the sidebar)
- Add class to Categories Widget
- How to Acheive the custom woocommerce category template
- How to add a rel attribute to images that contains their categories?
- How to set child post categories to parent post categories when updating parent post?
- Assign category using custom field?
- How To Get WordPress Categories Link List?
- Changing post category from dropdown
- Manipulate Output of wp_list_something: select menu instead of li’s
- Make Categories a Dropdown Menu in Media Library
- Programmatically Create Category and sub Category
- Attach parent category template to all subcategories
- exclude a category from a search on a specific page
- Get the category name outside of the loop in category.php
- Is it possible to change any of the HTML/URL returned from the_category()
- Custom HTML in specific category single page and its descendant categories
- Possible to display shortcode based on the category?
- Unset Category if other Category is unset during post transition
- Select pages by category
- Show Primary Category first when I display post categories
- How do I hide or remove ‘Category’ from wordpress breadcrumbs
- Ordering posts by publish date not working?
- Categories as main menu items and subcategories as nested lists
- Get category URL for current post
- Need help “sanitizing” a custom function that pulls category slug into body class
- allow only one post in specific category
- How to obtain the recent posts without their content in an efficient way?
- Setting a default text for excerpts of a particular category
- Running script based on Category
- Remove a category from a post when saving a new post
- How to fix get_the_category function returning incorrect slug?
- Return category name with & Ampersand doesnt work
- Access category within rss2_head hook?
- issue with if/elseif in_array inside foreach loop display only one post
- Randomizing wp_tag_cloud() in child theme
- add_filter to specific WooCommerce Category
- How to rewrite wordpress search to work on specific category
- Image loading function not working on archive.php template
- Problem with calling custom function in a foreach loop
- Specify multiple categories for custom post template – FATAL ERROR
- “All posts” in the category widget
- Get Attachment Category Name
- WordPress Categories: Function using custom SQL to return array of specific category IDs
- Display ACF category image on archive and single template files
- Get slug of current category in functions.php
- Display a list of random terms from custom taxonomy with shortcode
- Change category display name function
- Display link to category over featured image
- Remove the ‘category’ url for one category type
- Custom Function.PHP Code Not Working on One Site
- Adding new Category does not refresh the backoffice
- How do i tweak my wp Post title base on category of the post
- how to remove a tag in the_category function
- Menu and category highlighting for a single post
- i can’t use wordpress functions in ajax loaded php file
- Graphic before title – Specific Category
- require_once() Causing categories and tag pages on dashboard to not refrsh
- different body classes for each category
- How To Get WordPress Categories Last Update Date?
- How to get tags and categories?
- How to Insert A List of Posts in A Category Written by the Author into the Author Archive
- Removing all Category pages with one exception
- Get category of post inside save_post hook
- Exclude a category ID from the following function
- Adding a second email address to a completed order in WooCommerce [closed]
- Possible to search by author name with default WordPress search function?
- Influence of WordPress functions on site speed
- Is it possible to override this function/class in a child theme?
- When new user register then add new user role
- Remove bulk actions based on user role or capabilities
- Set first oembed in post to a global variable or function
- Adding extra SVGs to TwentyNineteen child theme using class TwentyNineteen_SVG_Icons
- wp_delete_attachment
- WordPress registration and contact form 7 [closed]
- PHP files included in functions.php don’t seem to work
- WordPress shortcode attributes for database SELECT?
- How to get membership level for specific user email
- Backstretch.js and thumbnail sizes to reduce loading time
- Updating Media Published Date When Parent Post Is Modified in WordPress
- Creating A New Admin Menu Tab For Theme Options
- Run wp_kses_decode_entities on atom feed?
- Function extending with if query in functions.php
- What is wrong with code added to functions.php to selectively show styles based on login state
- How can I set the SRC URL of the custom logo image?
- The Capability to choose post/page template
- WooCommerce -> wc_enqueue_js not working [closed]
- Use existing image sizes for WooCommerce
- Any adverse effects of adding apply_filters to a function?
- How can I remove page titles without removing the link in the navigation bar in twentyeleven?
- WordPress Function Assistance with Loop
- Add Change role button for list of user in an event
- I am trying to set post terms to a custom taxonomy
- Classic TinyMCE messing up only Contributor’s HTML
- Disable links to images only if link is an image
- Will my WordPress site become vulnerable after adding this functions which allows more HTML tags for subscribers?