Frontend: show posts of the author
-
Hello.
I have the pro plugin.
I have unexpected results in frontend.
The author can only sort and view his posts. In wp-admin works fine, but in frontend the logged user (author) can see the posts of other authors.
I have this function that works fine, but in frontend does not.
add_action('pre_get_posts', 'query_set_only_author' ); function query_set_only_author( $wp_query ) { global $current_user; if( is_admin() && !current_user_can('edit_others_posts') ) { $wp_query->set( 'author', $current_user->ID ); add_filter('views_edit-post', 'fix_post_counts'); add_filter('views_upload', 'fix_media_counts'); } }
Can you help me?
Thanks in advanced
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Frontend: show posts of the author’ is closed to new replies.