Home › Forums › Backend Issues (wp-admin) › Loading ACF Field Output on Page Editor › Reply To: Loading ACF Field Output on Page Editor
I don’t think that $post will be defined at this point, so you may need to figure it out, see my comments
// Load admin styling
function apache_admin_style() {
wp_enqueue_style('admin-css', get_template_directory_uri() . '/css/admin.css');
wp_enqueue_script( 'admin-js', get_template_directory_uri() . '/js/admin.js', array( 'jquery' ), null, true );
include get_template_directory() . '/inc/c-styling.php';
global $post;
// this may still not be set, you may need to get the post ID from the URL ($_GET)
// or you may be able to use get_queried_object()
$post_css = get_field('custom_css', $post->ID); if ( $post_css ) { echo '<style type="text/css">' . $post_css . '</style>'; };
}
add_action('admin_enqueue_scripts', 'apache_admin_style');
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.