Guest User

Untitled

a guest
May 23rd, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. function fake_sticky_posts_for_author() {
  2. $user = wp_get_current_user();
  3.  
  4. if ( get_current_user_id() && in_array('author', $user->roles) ) {
  5. return get_posts( array(
  6. 'author' => get_current_user_id(),
  7. 'fields' => 'ids',
  8. 'posts_per_page' => -1
  9. ) );
  10. }
  11.  
  12. return false;
  13. }
  14. add_filter( 'pre_option_sticky_posts', 'fake_sticky_posts_for_author' );
  15. // we use pre_option_sticky_posts in here, since we want to ignore value of this option, so there is no point to load it
Add Comment
Please, Sign In to add comment