Title: Moving Function to Header..
Last modified: August 19, 2016

---

# Moving Function to Header..

 *  Resolved [Lou Sparx](https://wordpress.org/support/users/roulettered/)
 * (@roulettered)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/moving-function-to-header/)
 * Hi guys,
 * I’m trying to move some PHP code from my Functions.php to my Header.php.
 *     ```
       function hello() {
       global $post;
       if (!is_single()) {
           return;
       }
   
       //print_r($post);
       $pony = strip_tags($post->post_content);
       $pony = str_replace(array('"',"'", "\n", "\r", "\t"), ''', $pony);
   
       echo "$pony";
       }
   
       add_action('wp_head', 'hello');
       ```
   
 * I’ve tried:
 *     ```
       <?PHP {
       global $post;
       if (!is_single()) {
           return;
       }
   
       //print_r($post);
       $pony = strip_tags($post->post_content);
       $pony = str_replace(array('"',"'", "\n", "\r", "\t"), ''', $pony);
   
       echo "$pony";
       }
   
       ;?>
       ```
   
 * **etc..** But this doesn’t work.
 * Any help would be much appreciated.
 * Thanks,
    Lou

Viewing 16 replies (of 16 total)

[←](https://wordpress.org/support/topic/moving-function-to-header/?output_format=md)
[1](https://wordpress.org/support/topic/moving-function-to-header/?output_format=md)
2

 *  [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * (@t31os_)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/moving-function-to-header/page/2/#post-1642895)
 * No worries Lou, you’re welcome.. 🙂

Viewing 16 replies (of 16 total)

[←](https://wordpress.org/support/topic/moving-function-to-header/?output_format=md)
[1](https://wordpress.org/support/topic/moving-function-to-header/?output_format=md)
2

The topic ‘Moving Function to Header..’ is closed to new replies.

## Tags

 * [functions](https://wordpress.org/support/topic-tag/functions/)
 * [header](https://wordpress.org/support/topic-tag/header/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 16 replies
 * 3 participants
 * Last reply from: [Mark / t31os](https://wordpress.org/support/users/t31os_/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/moving-function-to-header/page/2/#post-1642895)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
