I have an array of categories, some with an & i.e. events & entertainment.
My script imports these categories and gets the ID of each using its name.
$cat_id = array(get_cat_id($linearray),get_cat_id($linearray),get_cat_id($linearray),get_cat_id($linearray));
My script then adds a post to wp using these category ID’s.
My problem is that categories from my import with the & are not imported.
These same categories (when an email notice is sent) break the email at the &.
Is there a simple workaround to this?
When you are writing post, instead of
& you can write
& there and it will be translated to
& without any problems.
Also you could use the
str_replace function to convert that to
$new_text = str_replace('&', '&', $your_string);