I'm developing a plugin to replace a character that google doesn't show it with an accepted character. I want to get all the texts that wordpress returns (content, comments, title, names, etc.) but I don't know what hook should I use to do it. Can anybody help me?
1 Answer
There's a lot of filter hooks available, and your question is rather board. However, generally WordPress-generated content is handled by three hooks:
the_title
: applied to the post title retrieved from the database, prior to printing on the screen (also used in some other operations, such as trackbacks).the_content
: applied to the post content retrieved from the database, prior to printing on the screen (also used in some other operations, such as trackbacks).comment_text
: applied to the comment text before displaying on the screen by the comment_text function, and in the admin menus
These filters only moderfy the front-end of your site, meaning that the content will appear unfiltered in the admin area and in the database.
You can filter the content attatched to these hooks by writing a PHP function and then registering it with your hook:
add_filter( 'comment_text', 'my_func' );
To see an example of how these filters can be used, have a look at the capital_P_dangit()
function.