First off, don't change WordPress core files. It will just get overwritten anyway next update.
Instead, make the changes to your child theme's files so they won't be lost.
Here's an example to show next post that's not in category ID 13.
Code:
<?php next_post_link( '%link', 'Next post', FALSE, '13' ); ?>