Support

Account

Home Forums Backend Issues (wp-admin) my_acf_admin_head errors

Solving

my_acf_admin_head errors

  • I’ve implemented my_acf_admin_head in order to give users the ability to add a global background image to the website. I’ve added the codebelow to my functions.php.

    I have wp-config in debug mode. It is kicking a bunch of warning errors when I log in or out of wordpress.

    Here is the error log…

    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-login.php on line 402
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-login.php on line 415
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 914
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 915
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 916
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 917
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 918
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 919
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 922
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 923
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 924
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 925
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 928
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 929
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 930
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 931
    
    Warning: Cannot modify header information - headers already sent by (output started at /Users/robertrhu/Documents/Websites/vail/wp-content/themes/thisisepic/library/user-styles.php:2) in /Users/robertrhu/Documents/Websites/vail/wp-includes/pluggable.php on line 1174

    Here is the code

    <!--USER INPUT STYLES FUNCTION-->
        <?php function my_acf_admin_head() {
        
            $backgroundimage = get_field('background_image', 'option');
        
            ?>
            <!--BEGIN USER INPUT STYLES-->
            <style type="text/css">
                
                /**Adds custom global background image**/
                .main-content {
                    background-image: url(<?php echo $backgroundimage; ?>);
                }
                
            </style>
            <?php
        }
        add_action('wp_head', 'my_acf_admin_head');
        ?>
        <!--END USER INPUT STYLES-->
  • Figures it out. It was the spaces in my_acf_admin_head. Cleaned it up like this…

    <?php function my_acf_admin_head() {
        $backgroundimage = get_field('background_image', 'option'); ?>
        <!--BEGIN USER INPUT STYLES-->
        <style type="text/css">
            /**Adds custom global background image**/
            .main-content {
                background-image: url(<?php echo $backgroundimage; ?>);
            }
        </style>
    <?php } add_action('wp_head', 'my_acf_admin_head'); ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘my_acf_admin_head errors’ is closed to new replies.