Skip to content

Instantly share code, notes, and snippets.

@resarahman
Created November 3, 2015 10:25
Show Gist options
  • Save resarahman/a7cae9a3d4ba6bfc637d to your computer and use it in GitHub Desktop.
Save resarahman/a7cae9a3d4ba6bfc637d to your computer and use it in GitHub Desktop.

Revisions

  1. resarahman created this gist Nov 3, 2015.
    10 changes: 10 additions & 0 deletions functions.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,10 @@
    <?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);