• Resolved yulichka

    (@yulichka)


    When I updated the plugin from version 2.0.4 to version 2.3.3, a section of code using get_labels(); ceased to work.

    The code in question is:

    <?php
    $all_fields = $cfs->get();
    $field_labels = $cfs->get_labels();
    $ignore_fields = array('featured','winery','bottle_image','label_image','typology','fact_sheet','shelf_talker');
    
    foreach ($all_fields as $field_name => $field_value) {
    	if (!empty($field_value) && !in_array($field_name,$ignore_fields)) { ?>
    		<tr>
    			<td><h3><?php echo $field_labels[$field_name]; ?></h3></td>
    			<td><?php echo $field_value; ?></td>
    		</tr>
    <?php  }} ?>

    With the update, nothing showed below the beginning of the code. Beyond that, the WordPress admin bar turned white.

    Is there a way to update the code to be compatible? Or am I just missing something silly?

    Thanks so much for any help!

    https://www.ads-software.com/plugins/custom-field-suite/

Viewing 1 replies (of 1 total)
  • Plugin Author Matt Gibbs

    (@mgibbs189)

    Hey – yes, the get_labels method was deprecated in 1.8 and removed in 2.3.2. The get_field_info method is the replacement.

    <?php
    $all_fields = $cfs->get();
    $field_info = $cfs->get_field_info();
    $ignore_fields = array('featured','winery','bottle_image','label_image','typology','fact_sheet','shelf_talker');
    
    foreach ($all_fields as $field_name => $field_value) {
    	if (!empty($field_value) && !in_array($field_name,$ignore_fields)) { ?>
    		<tr>
    			<td><h3><?php echo $field_info[$field_name]['label']; ?></h3></td>
    			<td><?php echo $field_value; ?></td>
    		</tr>
    <?php  }} ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Did get_labels(); deprecate in version 2.3.3?’ is closed to new replies.