Location of twentyeleven theme’s option filters?

Hi I’m learning theming options based on the existing theme TwentyEleven.

I’ve come across the following code in inc/theme-options.php

Read More
return apply_filters( 'twentyeleven_default_theme_options', $default_theme_options );

I can’t seem to find the add_filter for ‘twentyeleven_default_theme_options’, or does it not even exist?

Related posts

Leave a Reply

2 comments

  1. I don’t believe there is an add_filter() call anywhere. If you want to override the option defaults, you can call your own add_filter() to do so, either in a Plugin or in a Child Theme.

    EDIT

    An apply_filters() call is nothing more than a filter hook definition: basically, it is defining the data to which a filter hook is applied.

    It is similar to do_action(), which is an action hook definition: it defines the template location/runtime execution point at which the action hook is fired.

    So, the presence of apply_filters() does not imply that there will necessarily be a corresponding add_filter() call; rather, it merely means that a filter is available to modify the specified data.

    On the other hand, the presence of add_filter() does imply that somewhere, a corresponding apply_filters() call exists – just as the presence of an add_action() call implies that somewhere, a corresponding do_action() call exists.

  2. apply_filters is required if you want to define your own filters, or wrap the existing ones with your custom filters. That’s what is happening in the code you saw. You won’t need to add any custom filters at a beginner stage, so won’t need to use apply_filters, at least until you get comfortable with the existing ones! WordPress provides you with a huge list of filters, check here and here for a category wise list of filters and how to use them. Start digging into these.