115 'context' => 'normal',
116 'priority' => 'high',
117 'show_names' => true, // Show field names on the left
118 'show_in_rest' => WP_REST_Server::READABLE,119 ) );
120
121 $meta_boxes->add_field( array(
275 'context' => 'normal',
276 'priority' => 'high',
277 'show_names' => true,
278 'show_in_rest' => WP_REST_Server::READABLE,279 ) );
280
281 $resources_group_field = $resources_metabox->add_field( array(
231 'context' => 'normal',
232 'priority' => 'high',
233 'show_names' => true, // Show field names on the left
234 'show_in_rest' => WP_REST_Server::READABLE,235 ) );
236
237 $articles_metabox->add_field( array(
205 'context' => 'normal',
206 'priority' => 'high',
207 'show_names' => true, // Show field names on the left
208 'show_in_rest' => WP_REST_Server::READABLE,209 ) );
210
211 $video_metabox->add_field( array(
165 'context' => 'normal',
166 'priority' => 'high',
167 'show_names' => true, // Show field names on the left
168 'show_in_rest' => WP_REST_Server::READABLE,169 ) );
170
171 $audio_metabox->add_field( array(
The class constant you're trying to access isn't valid and could lead to runtime errors.
This issue is raised for the following cases:
self
/static
/parent
outside a class.::class
constant on a dynamic string.::class
constant on an expression in PHP < 8.0. Accessing this value on an expression is supported only in PHP 8.0 and later.Any of the operations mentioned above would result in a fatal runtime error, and may potentially crash the application. Avoid performing such operations.
class Version
{
private const PHP_74 = 70400;
public const PHP_80 = 80000;
}
echo PhpVersion::PHP_80; // invalid: class "PhpVersion" doesn't exist
echo self::PHP_74; // invalid: cannot use "self" outside of a class
echo Version::PHP_56; // invalid: class constant "PHP_56" is undefined
$version = new Version;
echo $version::class; // note: this will only work on PHP 8.0 or later
class Version
{
public const PHP_56 = 50600;
public const PHP_74 = 70400;
public const PHP_80 = 80000;
}
// valid: make sure class exists and constant is defined
echo Version::PHP_80;
// valid: make sure to define constant that is being accessed
echo Version::PHP_56;
// valid: change visibility to public, or implement a getter method to retrieve the private constant or properties
echo Version::PHP_74;