Title: Function from included php file not working
Last modified: May 29, 2020

---

# Function from included php file not working

 *  [bostjanlaba](https://wordpress.org/support/users/bostjanlaba/)
 * (@bostjanlaba)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/function-from-included-php-file-not-working/)
 * If I create a function inside the Code Snippet, it works properly.
 * But if I use “include (‘myfunctions.php’) and then define
    add_shortcode( ‘myFunc’,‘
   MyFuncExt’ );
 * and MyFuncExt is defined in the myfunctions.php, shortcode call [myFunc] does
   not work at all.
 * Why can’t I use functions from external php file?
 * Thanks
 * Bostjan

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/function-from-included-php-file-not-working/#post-12911589)
 * Where do you have the `include ('myfunctions.php')` line? (e.g. in a snippet,
   in a file, etc)
 *  Thread Starter [bostjanlaba](https://wordpress.org/support/users/bostjanlaba/)
 * (@bostjanlaba)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/function-from-included-php-file-not-working/#post-12911590)
 * Hi, in the snippet.
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/function-from-included-php-file-not-working/#post-12965645)
 * Where is `myfunctions.php` located on the filesystem? You should specify an exact
   path instead of just including the filename.
 *  Thread Starter [bostjanlaba](https://wordpress.org/support/users/bostjanlaba/)
 * (@bostjanlaba)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/function-from-included-php-file-not-working/#post-12965693)
 * I will try this, thanks.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Function from included php file not working’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [bostjanlaba](https://wordpress.org/support/users/bostjanlaba/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/function-from-included-php-file-not-working/#post-12965693)
 * Status: not a support question