Hi ,
Thanks for your explain.
I followed your explanation and work perfectly! here is my code !
Thank for code quality checking!
`
function custom_get_xxx_post_where($whereSql) {
global $custom_get_xxx_post_where;
if(isset($custom_get_xxx_post_where) === true AND $custom_get_xxx_post_where === true) {
if($_SESSION[‘cat_name’] == ‘dsi’) {
$whereSql .= ‘ AND tt.term_id = 2 ‘;
} else if($_SESSION[‘cat_name’] == ‘metiers’) {
$whereSql .= ‘ AND tt.term_id = 3 ‘;
}
}
return $whereSql;
};
add_filter(‘get_previous_post_where’, ‘custom_get_xxx_post_where’);
add_filter(‘get_next_post_where’, ‘custom_get_xxx_post_where’);
<?php
$custom_get_xxx_post_where = true;
previous_post_link(‘<div class=”dossier-control hidden-sm hidden-xs”> %link</div>’, ‘Prev’, true);
next_post_link(‘<div class=”dossier-control hidden-sm hidden-xs”>%link</div>’, ‘Next’, true);
$custom_get_xxx_post_where = false;
?>
`