Skip to content

Instantly share code, notes, and snippets.

@hirozed
Last active January 17, 2021 05:28
Show Gist options
  • Save hirozed/a47ff6c07e3572cb213f91bace8e2fe1 to your computer and use it in GitHub Desktop.
Save hirozed/a47ff6c07e3572cb213f91bace8e2fe1 to your computer and use it in GitHub Desktop.
WordPress CMB2 Image
<?php
$cmb->add_field(
array(
'name' => __( '[CHANGEME-name]', '[CHANGEME-localization]' ),
'id' => '[CHANGEME-id]',
'desc' => __( '[CHANGEME-description]', '[CHANGEME-localization]' ),
'type' => 'file',
'options' => array(
'url' => false,
),
'query_args' => array(
'type' => array(
'image/gif',
'image/jpeg',
'image/png',
),
),
)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment