Ensure that role is not empty before adding it in add_role() function and methods.

Props MikeHansenMe, dannydehaan, michielhab.
Fixes #23746.


git-svn-id: https://develop.svn.wordpress.org/trunk@33967 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-09-09 03:41:27 +00:00
parent 047f3ef01a
commit 05e249d5ac
3 changed files with 9 additions and 1 deletions
@@ -471,6 +471,9 @@ function get_role( $role ) {
* @return WP_Role|null WP_Role object if role is added, null if already exists.
*/
function add_role( $role, $display_name, $capabilities = array() ) {
if ( empty( $role ) ) {
return;
}
return wp_roles()->add_role( $role, $display_name, $capabilities );
}