Automattic / hidden-posts

The opposite of sticky posts.
GNU General Public License v2.0
11 stars 5 forks source link

Remove hidden posts from next/previous links #37

Open nielslange opened 3 years ago

nielslange commented 3 years ago

Fixes #2

Note

Remove hidden posts from next/previous links.

Steps to test

  1. Check out this PR
  2. Head over to /wp-admin/edit.php?post_type=post
  3. Create the posts #2-1-visible, #2-2-hidden and #2-3-visible
  4. Ensure that #2-2-hidden is not marked as hidden for now
  5. Head over to /2-1-visible/
  6. Ensure that all posts appear in the next/previous links
  7. Head over to /wp-admin/edit.php?post_type=post
  8. Mark the post #2-2-hidden as hidden
  9. Head over to /2-1-visible/
  10. Ensure that only visible posts appear in the next/previous links
  11. Add filter add_filter( 'show_hidden_posts_in_pagination', '__return_true' );
  12. Ensure that both visible and hidden posts appear in the next/previous links
Before:

![#2-before](https://user-images.githubusercontent.com/3323310/124893346-eef79680-dfda-11eb-8187-907574012db4.png)
After:

![#2-after](https://user-images.githubusercontent.com/3323310/124893354-f159f080-dfda-11eb-9066-cdce832bcd36.png)