Skip to content

Commit

Permalink
fix (kses): added additional check if wp_get_current_user is not avai…
Browse files Browse the repository at this point in the history
…lable
  • Loading branch information
[email protected] committed Oct 1, 2024
1 parent b285710 commit 1020d3d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/kses.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@
* @return array Modified HTML tags & attributes.
*/
function stackable_allow_wp_kses_allowed_html( $tags, $context ) {
// For some reason, there are server setups that can call this too early and wp_get_current_user() is not yet defined.
if ( ! function_exists( 'wp_get_current_user' ) || ! function_exists( 'current_user_can' ) ) {
return $tags;
}

// Only allow these tags if the user can edit posts.
if ( ! function_exists( 'current_user_can' ) || ! current_user_can( 'edit_posts' ) ) {
if ( ! current_user_can( 'edit_posts' ) ) {
return $tags;
}

Expand Down

0 comments on commit 1020d3d

Please sign in to comment.