[wp-trac] [WordPress Trac] #56864: I want to put comments in theme.json.
WordPress Trac
noreply at wordpress.org
Thu Oct 20 06:59:48 UTC 2022
#56864: I want to put comments in theme.json.
-----------------------------+-----------------------------
Reporter: nendeb55 | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Keywords:
Focuses: |
-----------------------------+-----------------------------
theme.json is getting complicated.
It would be helpful to have a comment box to comment out the code or to
review it later or have others review the code.Currently theme.json has an
error when a comment is entered.
So I would like to be able to put comments in theme.json and expect it to
load correctly.
[https://github.com/WordPress/wordpress-
develop/blob/70dedb086602287f4e0ee97fbf477adda8310963/src/wp-
includes/functions.php#L4545]
Simple method with no consideration of security, null, etc.
{{{#!php
<?php
//$decoded_file = json_decode( file_get_contents( $filename ),
$options['associative'] );
$filedata = file_get_contents( $filename );
$filedata = preg_replace( '!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $filedata
);
$decoded_file = json_decode( $filedata , $options['associative'] );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/56864>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list