0

I have used apply_filters() while retrieving the content from WordPress post like:

$content=$query_val->post_content;
$content = apply_filters( 'the_content', $content );

When I was using apply_filters() the apostrophe( ' ) in my text shows some characters.After I have removed apply_filters() it shows properly.

So please explain it clearly!! What it is doing? I have referred this link Referal_link, but I'm not clearly understand.

0

If the characters are html entities like &nbsp &lt or &#60 then use php's default html_entity_decode() function to get the content in proper text format.

  • i had an attempt with html_entity_decode(), it doesnot work in some cases.After that only i came to try like this. – PHP Learner Sep 24 '14 at 9:01
  • You will have to use both strip_slashes as well as html_entity_decode. Exactly like this: html_entity_decode(strip_slashes($arg)); where $arg is the variable you are passing to remove special characters. – WisdmLabs Sep 24 '14 at 10:18
  • is apply_filters() compulsory to get the content? – PHP Learner Sep 24 '14 at 10:34
  • html_entity_decode(strip_slashes($arg)); shows Call to undefined function strip_slashes() in fatal error – PHP Learner Sep 24 '14 at 10:41
  • Sorry, the function is stripslashes($arg) and not strip_slashes(). – WisdmLabs Sep 25 '14 at 5:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.