title: wordpress: how to include a php file in frontend AND admin area (Fatal error: Cannot redeclare myfunction())
body: <p>I have some troubles to include a file called myplugin_functions.php</p>
  
  <p>This php file contains functions that are required to make some functions work in the wordpress admin area. For that reason I include this file in backend pages using:</p>
  
  <pre><code>include( plugin_dir_path( __FILE__ ) . 'myplugin_functions.php');
  </code></pre>
  
  <p>This works perfectly.</p>
  
  <p>When I do the same thing on frontend pages, the frontend can access these functions. Great.</p>
  
  <p>But when I then navigate to the backend I get an error message</p>
  
  <pre><code>Fatal error: Cannot redeclare myfunction() (previously declared in /www/htdocs/...) in /www/htdocs/..../myplugin_functions.php on line 28
  </code></pre>
  
  <p>include_once() makes the problem vanish. But I think wordpress doesn't like including the same php functions for frontend and backend. </p>
  
  <p>Do you know why?
  What is the best practice to get around this?</p>
  
  <p>Thank you?</p>