function map_meta_cap with issues since upgrade to WP 5.4.1
-
In WP 5.4.1 map_meta_cap() (in wp-includes/capabilities.php) has an optional parameter $args.
Since the upgrade to WP 5.4.1 for some reason on my site this function sometimes is called with $args containing an empty array, which causes a problem: If the $cap parameter equals ‘delete_post’ or ‘delete_page’ the line with
‘$post = get_post( $args[0] );’
will cause an error notice: ,Undefined offset: 0 in /…wp-includes/capabilities.php’because $args does not contain any of the optional elements.
Can you please insert something to prevent this, like changing the line mentione above to
$post = isset($args[0]) ? null : get_post( $args[0] )
In this way the content of $args would truly be optional as stated in the documentation of the function.Best regards
Florian
- The topic ‘function map_meta_cap with issues since upgrade to WP 5.4.1’ is closed to new replies.