Skip to main content
1 of 6
Rob
  • 1.4k
  • 13
  • 41
  • 68

Do action on publish or update?

Is there a way to only do a section of code on a template if the post has just been published or updated?

So for instance, I only want to do this ONCE:

$company = get_field('company_name');
$address = get_field('address');
$city = get_field('city');
$post_code = get_field('post_code');

When a post is published or updated. What do I need to wrap around that code?

Rob
  • 1.4k
  • 13
  • 41
  • 68