Home Forums Backend Issues (wp-admin) Populate Field using Post's Permalink


Populate Field using Post's Permalink

  • I’m using an add to calendar widget from and for the event’s location, I need to pull in the post url/permalink. But that field does not exist in dynamic’s data function. But I can pull in any ACF field, including a URL field.

    So I thought of creating an ACF that would be automatically generated/populated using the post’s permalink.

    I searched through different ideas but couldn’t find anything. Is this possible?


    add_filter('acf/save_post', 'post_permalink_to_field');
    function post_permalink_to_field($post_id) {
      $permalink = get_permalink($post_id);
      update_field('acf_permalink_field', $permalink, $post_id);
  • Perfect! That worked exactly as needed.

    Thank you very much!

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.