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.
Use stripslashes_deep()
function remove_slashes( $excerpt ) {
return stripslashes_deep( $excerpt );
}
add_filter( 'get_the_excerpt', 'remove_slashes' );