Home › Forums › Backend Issues (wp-admin) › Display custom field value on edit page › Reply To: Display custom field value on edit page
Thanks John – I figured something out.
I wrote this function:
function generate_acf_shortcode( $field ) {
echo '<pre>[post-snippet post="'; print_r($field['value']); echo '"]</pre>';
}
add_action( 'acf/render_field/type=page_link', 'generate_acf_shortcode', 10, 1 );
This generated the proper snippet syntax (actual short code i wrote elsewhere) inline with my page_link fields.
I followed that up by altering it to this:
function generate_acf_shortcode( $field ) {
$_SESSION['acf_post_link'] = $field['value'];
}
add_action( 'acf/render_field/type=page_link', 'generate_acf_shortcode', 10, 1 );
and then in the EMF field I called this to pull those values in for each field:
[post-snippet post="<?php echo $_SESSION['acf_post_link']; ?>"]
Ended up With this:
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!
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.