Created
November 3, 2015 10:25
-
-
Save resarahman/a7cae9a3d4ba6bfc637d to your computer and use it in GitHub Desktop.
Next/Prev post link based on meta_key value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function custom_next_prev_post_links( $join, $in_same_term, $excluded_terms, $taxonomy, $post ){ | |
| global $wpdb; | |
| $join .= " INNER JOIN $wpdb->postmeta AS m ON p.ID = m.post_id AND m.meta_key = 'your_meta_key_name'"; | |
| return $join; | |
| } | |
| add_filter('get_next_post_join', 'custom_next_prev_post_links', 10, 5); | |
| add_filter('get_previous_post_join', 'custom_next_prev_post_links', 10, 5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment