Hide custom field values on website

#33502
  • Resolved Danny
    Rank Math free

    My previous developer wrote the following code to display all custom field data:

    <?php $meta = getProductCustomFields( $product->get_id() ); ?>
    
    		<?php foreach ( $meta as $field => $value ): ?>
    			<?php if( $value !== '' ) { ?>
    			<p>
    				<strong class="field"><?php echo $field; ?></strong><br />
    				<span class="value"><?php echo $value; ?></span>
    			</p>
    			<?php } ?>
    		<?php endforeach; ?>

    Because of this, even the RankMath data in custom fields were displayed on the website. And after I deactivated the plugin, following RankMath custom field data still existed; rank_math_robots a:1:{i:0;s:5:”index”;}

    1. How do I remove all RankMath data from the custom fields?

    2. Or, how do I modify the developer’s code above to exclude Rank Math’s custom field data?

    Thank you in advance.

Viewing 1 replies (of 1 total)
  • Michael Davis
    Rank Math free

    Hello,

    Thanks for getting in touch with us.

    You can choose to add custom variables to your custom fields with this filter: https://rankmath.com/kb/filters-hooks-api-developer/#add-custom-variable

    Hope that helps and please do not hesitate to let us know if you need our assistance with anything else.

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Hide custom field values on website’ is closed to new replies.