I'm just getting into WordPress and keep seeing sample code with balanceTags() used when echoing out a variable.

Am I right in thinking it does nothing in terms of output validation?

Thank you


Right, so it will simply do its best to close any unclosed tag - that's it. Nothing more.

As you can see if you look at the source code, all the function does is make sure to balance out the tags that might not be. It's also explained in the codex. ("force_balance_tags" is the real function that does the work; "balanceTags" defers to it if the options or attributes ask it to)

Hope this helps!


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.