Rainy
Rainy

Reputation: 37

How do I disable magic quotes on Wordpress

How can I get my excerpts on my wordpress site to stop adding these slashes? I'm calling get_the_excerpt(); and have tried calling wp_filter_nohtml_kses(the_excerpt()) and stripslashes(the_excerpt()) but am still getting the same slashes to my excerpts. I've also tried making a filter to keep the quotes from being added but still didn't change anything:

function remove_slashes( $excerpt ) {
    return stripslashes( wp_filter_nohtml_kses( $excerpt ) );
}
add_filter( 'get_the_excerpt', 'remove_slashes' );

Any time there's a single or double quote, a slash is being added to the front of the quote. In my research I've learned that they're Magic Quotes from PHP, but using stripslashes has no effect.

Upvotes: 0

Views: 346

Answers (1)

Bhautik
Bhautik

Reputation: 11282

Use stripslashes_deep()

function remove_slashes( $excerpt ) {
    return stripslashes_deep( $excerpt );
}
add_filter( 'get_the_excerpt', 'remove_slashes' );

Upvotes: 1

Related Questions