By default, editors can edit all users post. But the problem is the dashboard, it only shows the current users post. So below is the code that enables only editor roles to display all posts into their dashboard, so they can edit all of them. Insert the code in your themes functions.php
[php]
/**
* Get a user role type by user id
*
* @example
* returns by giving user id is: ‘administrator' or ‘editor' or ‘subscriber'
*
* @global object $wpdb
* @param int $user_id
* @return string
*/
function wedevs_get_user_role( $user_id ) {
global $wpdb;
$user = get_userdata( $user_id );
if ( $user->ID ) {
$capabilities = $user->{$wpdb->prefix . ‘capabilities'};
if ( !isset( $wp_roles ) ) {
$wp_roles = new WP_Roles();
}
foreach ($wp_roles->role_names as $role => $name) {
if ( array_key_exists( $role, $capabilities ) ) {
return $role;
}
}
}
return false;
}
function wpufe_dashboard_query( $args ) {
$user_id = get_current_user_id();
if ( $user_id && wedevs_get_user_role( $user_id ) == ‘editor' ) {
unset( $args[‘author'] );
}
return $args;
}
add_filter( ‘wpuf_dashboard_query', ‘wpufe_dashboard_query' );
[/php]