[wp-trac] [WordPress Trac] #42230: current_user_can( 'install_languages' ) calls a function which may not be defined
WordPress Trac
noreply at wordpress.org
Sun Oct 15 20:03:15 UTC 2017
#42230: current_user_can( 'install_languages' ) calls a function which may not be
defined
-----------------------------+-------------------------
Reporter: johnbillion | Owner:
Type: defect (bug) | Status: new
Priority: low | Milestone: 4.9
Component: Role/Capability | Version: trunk
Severity: critical | Keywords: needs-patch
Focuses: |
-----------------------------+-------------------------
The following code causes a fatal error when used on the front end of a
site:
{{{
add_action( 'init', function() {
current_user_can( 'install_languages' );
} );
}}}
This is because the `install_languages` case inside `map_meta_cap()` calls
`wp_can_install_language_pack()` which in turn instantiates the
`WP_Upgrader` class and calls methods which call functions which are only
available in the admin context. `request_filesystem_credentials()` is
ultimately called and causes a fatal error because the function is only
available in the admin context.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42230>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list