frankiejarrett/expire-passwords

Fatal error for undefined function get_editable_roles()

frankiejarrett opened this issue · 0 comments

Today a user reported in the support forum that they were receiving a fatal error:

Fatal error: Call to undefined function get_editable_roles() in /wp-content/plugins/expire-passwords/expire-passwords.php on line 169

I can't reproduce it locally. But this has been discussed in other plugin support threads before too. It could be another plugin causing issues, or perhaps even a bug in WordPress core.

Nevertheless, the most straightforward fix will be to load in the file directly that defines get_editable_roles() if the function doesn't exist before calling it.

if ( ! function_exists( 'get_editable_roles' ) ) {
    require_once ABSPATH . 'wp-admin/includes/user.php';
}