Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: posts_where

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
1355           if ( ! empty($q['meta_key']) || ! empty($q['meta_value']) )
1356                $join .= " LEFT JOIN $wpdb->postmeta ON ($wpdb->posts.ID = $wpdb->postmeta.post_id) ";
1357           if ( ! empty($q['meta_key']) ) 
1358                $where .= $wpdb->prepare("AND $wpdb->postmeta.meta_key = %s ", $q['meta_key']);
1359           if ( ! empty($q['meta_value']) )
1360                $where .= $wpdb->prepare("AND $wpdb->postmeta.meta_value = %s ", $q['meta_value']);
1361
1362           // Apply filters on where and join prior to paging so that any
1363           // manipulations to them are reflected in the paging by day queries.
1364           $where = apply_filters('posts_where', $where);
1365           $join = apply_filters('posts_join', $join);
1366
1367           // Paging
1368           if ( empty($q['nopaging']) && !$this->is_singular ) {
1369                $page = absint($q['paged']);
1370                if (empty($page)) {
1371                     $page = 1;
1372                }
1373