• Hi, I’m currently developing a plug-in that would insert codes like meta tags and seo stuff on the head section of a site. I’m using
    add_action('wp_head', 'my function')

    to do this but the codes output right after the <body> tag. What am I doing wrong?

    Here’s some of my code:

    add_action('wp_head', 'wp_head_etc');
    
    function wp_head_etc() {
        global $my_options, $wp_query, $wpdb;
    
        $buffer = $my_options['header'];
    
        ob_start();
        eval('?>' . $buffer);
        $buffer = ob_get_contents();
        ob_end_clean();
        echo $buffer;
    }

    Any help would be much appreciated.

  • The topic ‘add_action('wp_head', function) not working’ is closed to new replies.