How does WordPress convert raw data from the database to a readable format in the_content function?
I’ve noticed that it applies the_content filter, but what does the_content filter do?
How does WordPress convert raw data from the database to a readable format in the_content function?
I’ve noticed that it applies the_content filter, but what does the_content filter do?
You must be logged in to post a comment.
the default filters are set in /wp-includes/default-filters.php;
for ‘the_content’ this is from line 135:
to trace the individual functions, you could try and use http://phpxref.ftwr.co.uk/wordpress/nav.html?_functions/index.html
then follow the links…
Edit
Missed one (
wp-includes/default-filters.php
, line 102):All filters are stored in the global
$wp_filter
variable. You can inspect that variable to see which functions are bound to a certain filter.To exactly understand the array that gets outputted, knowing how the
$wp_filter
variable is built up helps a lot. This line is from the source of theadd_filter()
function:The content_filter enables you to return custom content before or after the content.
2 very basic practical examples of using the_content filter in a custom function are as follows:
This example returns custom content before the content
This example returns custom content after the content