Skip to content

cf_custom-field meta import with checkbox custom fields #2972

@daaath

Description

@daaath

hello,

the plugin advanced custom fields gives you the option to create checkbox custom fields.

you can echo them for example with

<?php 
$field = get_field_object('custom-field-name');
$value = $field['value'];
$choices = $field['choices'];

if( $value ): ?>
<ul>
    <?php foreach( $value as $v ): ?>
    <li>
        <?php echo $choices[ $v ]; ?>
    </li>
    <?php endforeach; ?>
</ul>
<?php endif; ?>

if i take this checkbox customfield for the meta descript with %%cf_custom-field-name%% it only echos "Array" into the meta description.

Could you create a solution that the checked checkboxes are echoed with comma seperation ?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions