I am getting difficulties getting away double quotes while using PHP addslashes function. Basically run:

$name = addslashes(get_the_title());

And also the title has double quotes inside it, the output continues to have double quotes with no escape figures.

eg. “Welcoming Diversity” Immigration Forum

I am attempting to place Wordpress data into an .ICS file generator, but I am not able to find away out to effectively parse the Wordpress data right into a format that co-works using the ICS format.

SOLUTION: My solution ended up being to bypass the Wordpress function get_the_title() by utilizing $publish->post_title rather. Getting away labored correctly with addslashes after i switched.

Maybe trim helps (for scaping regular quotes):

$name = addslashes(trim(get_the_title(), '"'));

For other type of quotes you could attempt using regular expressions. Something similar to:

$title = preg_replace("/[\'\"\”\“]+/";, '', get_the_title());
$name = addslashes($title);

When the quotes aren't getting steered clear of they aren't true double quotes. It might be that the string is within a multibyte charset, or they're "fancy quotes".

This function frequently sorts this out:

function convert_fancy_quotes ($str) {
  return str_replace(array(chr(145),chr(146),chr(147),chr(148),chr(151)),array("'","'",'"','"','-'),$str);

So try:

$name = addslashes(convert_fancy_quotes(get_the_title()));

...although if this sounds like the issue, they most likely have no need for getting away anyway, based on your work using the result.

The curly quotes is certainly something to check on for. Additionally you may want to look into the expected input of function you are delivering to. The addslashes() function will certainly add the escape figures, but when you are delivering that output into another function that removes them, that may allow it to be appear the slashes aren't being steered clear of.