Home › Forums › Front-end Issues › Insert field at hook-position using function.php › Reply To: Insert field at hook-position using function.php
Hi James,
thanks for your advice. I tried to get the post ID but somehow it didn´t work.
Now my code looks like this:
// Add acf field to product generator page
add_filter('vpc_container_end', 'add_table', 10, 1);
function add_table($value){
global $post;
$value .= get_field('testfield', $post->ID);
return $value;
}
For testing I also tried to enter the ID of a specific post:
$value .= get_field('testfield', 17890);
But this doesn´t work either. :-/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
🤔 Curious about the ACF user experience? So are we! Help guide the evolution of ACF by taking part in our first ever Annual Survey and guarantee you’re represented in the results. https://t.co/0cgr9ZFOJ5
— Advanced Custom Fields (@wp_acf) May 8, 2023
© 2023 Advanced Custom Fields.
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.