Trying to edit View "WO Shows with Month Separators"
When entering the Template Block Editor we get the following error:
Fatal error: Uncaught Error: date(): Argument #2 ($timestamp) must be of type ?int, string given
in \functions.php on line 118 which relates to custom date function:
// Add Shortcode
function convert_date2( $atts ) {
That looks like you added some custom code to your site to register a custom shortcode, and with PHP 8 it is enforcing the date function attribute types.
You can coerce the string to be an integer (as required) by simply adding (int) before the problem attributes, i.e.
// Add Shortcode
function convert_date2($atts)
{
// Attributes
$atts = shortcode_atts(
array(
'timestamp' => '',
),
$atts
);
$date = date('D d M y \a\t g:ia', (int) $atts['timestamp']);
return $date;
}
add_shortcode('convert_date2', 'convert_date2');
The topic ‘[Closed] Error when editing Block Template in View since PHP 8.0’ is closed to new replies.