Support » Networking WordPress » hook the body tag

  • leisegang


    is there any way of using this code only on the frontend of wordpress and not in the backend?

    I get “YOUR INSERTED HTML GOES HERE” in the admin area also. which i dont want but i need to “hook” the body tag.

    function yoursite_template_include($template) {
    	return $template;
    function yoursite_shutdown() {
    	$insert =  "[YOUR INSERTED HTML GOES HERE]";
    	$content = ob_get_clean();
    	$content = preg_replace('#<body([^>]*)>#i',"<body$1>{$insert}",$content);
    	echo $content;
Viewing 1 replies (of 1 total)
  • s_ha_dum


    You can always check to see if it is an admin page.

    if (is_admin()) {
        // do
    } else {
       // or do not
Viewing 1 replies (of 1 total)
  • The topic ‘hook the body tag’ is closed to new replies.