WordPress: Inhabilitar mostrar entradas y medios de otros usuarios

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');
 }
}

Visto en Collectiveray

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

Scroll al inicio

We are using cookies on our website

Please confirm, if you accept our tracking cookies. You can also decline the tracking, so you can continue to visit our website without any data sent to third party services.