I added a hook to the_content
.
add_filter('the_content', 'edit_the_content');
function edit_the_content($content){
return $content;
}
Pretty simple right?
However, when it output $content
from within my edit_the_content()
callback it seems like WordPress converts some, but not all characters into special characters.
Example:
it’s = it’s
but then an anchor tag, remains untouched and not converted.
Is there some sort of filter which runs on the_content
which only converts some characters to special characters, but not all?
Using a snippet of code like this:
I was able to find a list of all hooked callback functions to the WordPress filter:
the_content
.I then located a few possible culprits, then searched for their function existence.
After narrowing down my list, I came to the conclusion on the hooked callback function causing the problem.
In the file
./wp-includes/default-filters.php
on line 135 as of WordPress 3.6 there is a hooked functionadd_filter('the_content', 'wptexturize');
In the file
./wp-includes/formatting.php
on line 29 as of WordPress 3.6 there is the function definition ofwptexturize()
.How to prevent WordPress from formatting
the_content
characters into HTML entities?Lesson learned. Using that snippet of code at the beginning of this answer will help you to… at a minimum, find all the attached callback functions to a particular WordPress hook. Which is a great start, the rest may take a bit of searching and reading what each callback function does.