Home Forums General Issues Saving Field as a variable not working


Saving Field as a variable not working

  • Hello, Im new to the forum

    I was trying to save the field (a color field) to a variable in pho

    <?php $colourHoy = the_field('colour_pagina'); ?>

    it’s not working

  • Hi @o3odesigns

    Use the get_field() function, instead of the_field() function to store it as a variable. Look at the example below:

    <?php $colourHoy = get_field('colour_pagina'); ?>

  • Gracias mikerodriguez

    that worked. I will keep that tip in mind

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.