Custom field in description shows serialized array

#364807
  • Resolved Jeroen Zelle
    Rank Math free

    Hi,

    I am using Advanced Custom Fields (ACF) to add custom fields to WooCommerce products. One of the fields, the size of a dress, needs to be displayed in the SEO Description field.

    The field in ACF is a checkbox with multiple sizes which can be selected. So a dress can have size 36, 38 as a value.

    I am using this code for that in RankMath: %customfield(jurken-geschiktvoormaat)%

    In the RankMath preview (and in SEO tools) it shows as: a:2:{i:0;s:2:"36";i:1;s:2:"38";}
    When I use that same custom field in Elementor as a dynamic value, it displays as: 36, 38.

    So, how can I display the correct output in RankMath?

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting us and sorry for any inconvenience that might have been caused due to that.

    The variable that we have called %customfield(field-name)% can only be used to output data from text fields and similar.

    For other types of fields you need to create a custom variable with the following filter: https://rankmath.com/kb/filters-hooks-api-developer/#add-extra-variables

    In the callback function, you need to parse the result from the custom field to output it in a more readable manner.

    Don’t hesitate to get in touch if you have any other questions.

    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 ‘Custom field in description shows serialized array’ is closed to new replies.