WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 3 times in this file.
Line | Code |
---|---|
59 | * |
60 | * The dynamic portion of the hook name, $option, refers |
61 | * to the option name. |
62 | * |
63 | * @since 3.4.0 |
64 | * |
65 | * @param mixed $default The default value to return if the option |
66 | * does not exist in the database. |
67 | */ |
68 | return apply_filters( 'default_option_' . $option, $default ); |
69 |
|
70 | $alloptions = wp_load_alloptions(); |
71 |
|
72 | if ( isset( $alloptions[$option] ) ) { |
73 | $value = $alloptions[$option]; |
74 | } else { |
75 | $value = wp_cache_get( $option, 'options' ); |
76 |
|
77 | if ( false === $value ) { |
Line | Code |
80 | // Has to be get_row instead of get_var because of funkiness with 0, false, null values |
81 | if ( is_object( $row ) ) { |
82 | $value = $row->option_value; |
83 | wp_cache_add( $option, $value, 'options' ); |
84 | } else { // option does not exist, so we must cache its non-existence |
85 | $notoptions[$option] = true; |
86 | wp_cache_set( 'notoptions', $notoptions, 'options' ); |
87 |
|
88 | /** This filter is documented in wp-includes/option.php */ |
89 | return apply_filters( 'default_option_' . $option, $default ); |
90 | } |
91 | } |
92 | } |
93 | } else { |
94 | $suppress = $wpdb->suppress_errors(); |
95 | $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", $option ) ); |
96 | $wpdb->suppress_errors( $suppress ); |
97 | if ( is_object( $row ) ) { |
98 | $value = $row->option_value; |
99 | } else { |
100 | /** This filter is documented in wp-includes/option.php */ |
101 | return apply_filters( 'default_option_' . $option, $default ); |
102 | } |
103 | } |
104 |
|
105 | // If home is not set use siteurl. |
106 | if ( 'home' == $option && '' == $value ) |
107 | return get_option( 'siteurl' ); |
108 |
|
109 | if ( in_array( $option, array('siteurl', 'home', 'category_base', 'tag_base') ) ) |
110 | $value = untrailingslashit( $value ); |