Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I have to add_filter() before apply_filters() in Wordpress?

I'm trying to understand Wordpress plugin like:

apply_filters( 'gettext', $translations->translate( $text ), $text, $domain );

I'm looking for all codes in Wordpress, I can't find:

add_filter( 'gettext', ....);

Why there is no add_filter for this plugin? Or I missed something? Same thing like:

do_action('wp_loaded');

I can't find:

add_action('wp_loaded', ....);

like image 527
wordpressquestion Avatar asked Mar 23 '11 06:03

wordpressquestion


1 Answers

apply_filters is like, 'if there are any filters with this name, run the attached callbacks with these parameters'. So if there is no add_filter for that name, it means that there is no filter that's going to be run with the apply_filters call at the moment.

The same goes with do_action and add_action.

like image 170
Dogbert Avatar answered Oct 01 '22 04:10

Dogbert