Предыдущий/Следующая запись в Wordpress
SELECT wposts.*
FROM wpr_posts wposts
LEFT JOIN wpr_term_relationships ON (wposts.ID = wpr_term_relationships.object_id)
LEFT JOIN wpr_term_taxonomy ON (wpr_term_relationships.term_taxonomy_id = wpr_term_taxonomy.term_taxonomy_id)
WHERE wpr_term_taxonomy.taxonomy = 'rubrics'
AND wpr_term_taxonomy.term_id = '4'
AND wposts.post_status = 'publish'
AND wposts.post_type = 'material'
AND wposts.ID < '53'
ORDER BY wposts.ID DESC
LIMIT 1