How to Restrict Previous & Next Post Link to Posts of Same Category?

Choose from any of the following functions:

  1. get_next_post_link();
  2. next_post_link();
  3. get_previous_post_link();
  4. previous_post_link();

Parameters are as follows (in respective order):

  1. @param string $format Optional. Link anchor format. Default ‘« %link’.
  2. @param string $link Optional. Link permalink format. Default ‘%title’.
  3. @param bool $in_same_term Optional. Whether link should be in a same taxonomy term. Default false.
  4. @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
  5. @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default ‘category’.

@return string The link URL of the next post in relation to the
current post.

Optionally, you could do more with your pagination if you opted for more labor. You could use get_next_post(); or get_previous_post(); These two functions would allow you to retrieve the entire next/previous post object. You could then retrieve post meta, featured image, post format, post excerpt, etc.

Parameters are as follows (in respective order):

  1. @param bool $in_same_term Optional. Whether post should be in a same taxonomy term. Default false.
  2. @param array|string $excluded_terms Optional. Array or comma-separated list of excluded term IDs. Default empty.
  3. @param string $taxonomy Optional. Taxonomy, if $in_same_term is true. Default ‘category’.

@return null|string|WP_Post Post object if successful. Null if
global $post is not set. Empty string if no corresponding post
exists.

All of this (and more) can be found in ./wp-includes/link-template.php