• i have made a plugin to add a rejected post status by using post meta table, so for showing not rejected posts on frontend i have used pre_get_posts filter to SET the meta_query , it works everywhere but for the next_post_link and previous_post_link its not working.

    i have searched but couldn’t find any solution that how to filter navigation links of the rejected posts having meta_key= ‘_is_rejected’ meta_value= ‘yes’

    so by now i have modified the Core file wp-includes/link-template.php inside function get_adjacent_post() by adding the following lines

    if(is_single()){
    $where .= ” AND p.ID NOT IN ( SELECT post_id FROM wp_postmeta WHERE meta_key=’_is_rejected’ AND meta_value=’yes’ )”;
    }

    any Good solution please? so that i could do it without modifying the core files?

  • The topic ‘next_post_link filtering posts by custom post meta_query problem’ is closed to new replies.