Function Reference: geodir_previous_next_post_where
Summary
Filters the WHERE clause in the SQL for an adjacent post query.
Global Values
- $wpdb
- (object) (required) WordPress Database object.
- Default: None
- $plugin_prefix
- (string) (required) Geodirectory plugin table prefix.
- Default: None
Package
GeoDirectory
Parameters
- $where
- (string) (required) The `WHERE` clause in the SQL.
- Default: None
- $in_same_term
- (bool) (required) Whether post should be in a same taxonomy term.
- Default: None
- $excluded_terms
- (array) (required) Array of excluded term IDs.
- Default: None
- $taxonomy
- (string) (required) Taxonomy. Used to identify the term used when `$in_same_term` is true.
- Default: None
- $post
- (WP_Post) (required) WP_Post object.
- Default: None
Return Values
- (string)
- Filtered SQL WHERE clause.
Change Log
Since: 1.6.16
Source File
geodir_previous_next_post_where() is located in geodirectory_template_actions.php [Line: 3573]
Source Code
function geodir_previous_next_post_where( $where, $in_same_term, $excluded_terms, $taxonomy, $post ) { global $wpdb, $plugin_prefix; if ( !empty($post->post_type) && ( !empty( $post->country_slug ) || !empty( $post->region_slug ) || !empty( $post->city_slug ) ) && in_array( $post->post_type, geodir_get_posttypes() ) ) { $post_locations = ''; $post_locations_var = array(); if ( !empty( $post->country_slug ) ) { $post_locations .= " AND post_locations LIKE %s"; $post_locations_var[] = "%,[" . $post->country_slug . "]"; } if ( !empty( $post->region_slug ) ) { $post_locations .= " AND post_locations LIKE %s"; $post_locations_var[] = "%,[" . $post->region_slug . "],%"; } if ( !empty( $post->city_slug ) ) { $post_locations .= " AND post_locations LIKE %s"; $post_locations_var[] = "[" . $post->city_slug . "],%"; } $where .= $wpdb->prepare( $post_locations, $post_locations_var ); } return $where; }