Your conditional, is_category()
is wrong here. is_category()
checks whether or not you are actually on a category page. By using the !
operator in conjuction with is_category()
and ID 1293
, this part of the condition will always return true except when you are actually on the category page for category 1293
.
If you need to exclude a certain set of posts from the category 1293
, you should use the conditional check, in_category()
or has_category()
(in essence, they both are excatly the same). So your conditional statement should look something like this:
if ( is_single() // Make sure we are on a single page
&& ! in_category( '1293' ) // Make sure the post does not belong to category 1293
&& ! is_admin() // Make sure this is not an admin page
) {
return prefix_insert_after_paragraph( $ad_code, 2, $content );
}